Skip to content

gwillem/parse-nginx-json-logs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Nginx JSON log parser

Add this to your Nginx config:

    log_format json
        '{'
        '"time":"$time_iso8601", '
        '"remote_addr":"$remote_addr", '
        '"remote_user":"$remote_user", '
        '"host":"$http_host", '
        '"status":"$status", '
        '"method":"$request_method", '
        '"uri":"$request_uri", '
        '"protocol":"$server_protocol", '
        '"body_bytes_sent":"$body_bytes_sent", '
        '"referer":"$http_referer", '
        '"user_agent":"$http_user_agent", '
        '"request_time":"$request_time", '
        # Next line depends on Cloudflare sending a country code
        '"country":"$http_cf_ipcountry", '
        '"port":"$server_port"'
        '}';

    access_log /var/log/nginx/access.log json;

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages