3.2 Ensure access logging is enabled

Information

The access_log directive enables the logging of client requests. While NGINX enables this by default, it allows granular control per server or location context. Based on enterprise requirements, the log should be enriched with relevant variables or converted to structured JSON format for modern SIEM integration. Refer to Recommendation 3.1 for detailed configuration of log formats and variables. Ensure that access logging is active for all critical services.

Access logs are the primary record of system usage, detailing who accessed what resources and when and general troubleshooting. Without active access logs, incident responders are blind to web-based attacks (such as SQL injection, XSS probing, or Brute Force attempts) and auditors cannot verify compliance or user activity. Disabling logs globally ( access_log off; ) effectively destroys the forensic chain of custody for security events.

NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance.

Solution

Enable access logging in the http block to set a secure global default, or configure it explicitly within specific server blocks. It is recommended to use the detailed log format defined in Recommendation 3.1.

Configuration Example:

http {

# Enable global logging using the detailed JSON format from Rec 3.1
access_log /var/log/nginx/access.json main_access_json;

server {

# Inherits the global log setting, or can be overridden:
access_log /var/log/nginx/example.com.access.json main_access_json;

location / {
# ...
}

# Exception: Disable logging for favicon to reduce noise (Optional)
location = /favicon.ico {
access_log off;
log_not_found off;
}
}
}

Impact:

Enabling detailed access logging increases disk space usage significantly. Without proper log rotation (e.g., logrotate ) and monitoring, log files can rapidly consume available disk space, potentially causing the server to stop processing requests or crash. Ensure sufficient storage capacity and retention policies are in place.

See Also

https://workbench.cisecurity.org/benchmarks/18528

Item Details

Category: AUDIT AND ACCOUNTABILITY

References: 800-53|AU-3, 800-53|AU-3(1), 800-53|AU-7, 800-53|AU-12, CSCv7|6.3

Plugin: Unix

Control ID: 2b2ead26f763424fc935ea95e42c1fd21eabae20b7b774867c4afffd3726753c