The original post: /r/nginx by /u/Historical_Ad4384 on 2024-07-15 14:49:39.

Hi,

I have a custom log format that I define within the http block of my nginx config file

How do I tell NGINX to use this custom log format?

Here is the snippet of the custom log format definition:

    log_format json_combined escape=json
    '{'
        '"time_local":"$time_local",'
        '"remote_addr":"$remote_addr",'
        '"remote_user":"$remote_user",'
        '"request":"$request",'
        '"status": "$status",'
        '"body_bytes_sent":"$body_bytes_sent",'
        '"request_time":"$request_time",'
        '"http_referrer":"$http_referer",'
        '"http_user_agent":"$http_user_agent"'
    '}';