accounting_log

The `accounting_log` directive configures the logging output for traffic metrics monitored by the accounting module in NGINX.

Syntaxaccounting_log [level];
Defaultnone
Contextstream
Arguments1+

Description

The accounting_log directive is utilized within the context of the stream in NGINX to specify where the computed traffic metrics will be logged. By supporting one or more log file paths, this directive allows administrators to track incoming and outgoing traffic metrics effectively. The directive plays a crucial role in the traffic accounting module, which works by aggregating metrics based on predefined identifiers (accounting_ids) and is triggered at defined intervals. When the specified log file is filled, the metrics are rotated and exported, providing a means to analyze traffic data in real time. The parameter specified can direct logs to local files, the standard error output, or a remote syslog server, enhancing flexibility in log management.

Config Example

accounting_log logs/http-accounting.log;

Ensure the specified log file path is writable by the NGINX worker processes.

Using a file that does not exist will require proper permissions to create the log file.

Avoid configuring conflicting log paths with different directives to prevent unexpected behavior.

← Back to all directives