log_format

The log_format directive specifies the format of logs generated by the NGINX SRT module.

Syntaxlog_format name string;
Defaultnone
Context
Arguments2+

Description

The log_format directive allows you to customize the log format used in the NGINX SRT module. By setting this directive, you can define the content and structure of log entries that record information about SRT sessions, connections, and data transfers. You can include predefined variables to capture specific details such as the remote address, user agent, and custom SRT parameters, thereby tailoring the logs to your monitoring and debugging needs.

Each log format is defined by a name and one or more parameters that dictate what data is stored in the logs. The parameters can include standard NGINX variables such as $remote_addr, and you can also include module-specific variables for more granular logging related to SRT operations. The combination of these variables makes it easier to format logs consistently without hard-coding any values, thus enhancing the flexibility of logging features in SRT contexts.

After defining a log format with the log_format directive, you must then use the access_log directive to link it to a specific log file where the entries will be written. This effective separation allows for maintaining various logging configurations for different services or contexts within NGINX.

Config Example

log_format srt_format '$remote_addr - $remote_user [$time_local] "$request" $status $bytes_sent';
access_log /var/log/nginx/srt_access.log srt_format;

Ensure that the log format name is unique to avoid conflicts with other log formats defined in your NGINX configuration.

Remember to set the access_log directive to associate your custom log format with a log file, or the format won't be used.

← Back to all directives