diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b38dec..88c1349 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 1.19.5-4 + +* Renamed `main` logging format to `main_default`. +* Remove unnecessary double space between `$time_local` & `$status` from + `main_default` logging format. +* Add `main_json` logging format and configure it on `access_log`. + ## 1.19.5-3 * Set or forward `X-Request-ID`. diff --git a/config/log.conf b/config/log.conf index 047b6e4..385f33d 100644 --- a/config/log.conf +++ b/config/log.conf @@ -1,6 +1,27 @@ -log_format main '$remote_addr - $remote_user [$time_local] $status ' - '"$request" $body_bytes_sent "$http_referer" ' - '"$http_user_agent" "$http_x_forwarded_for" $proxy_x_request_id'; +log_format main_default escape=default + '$remote_addr - $remote_user [$time_local] $status ' + '"$request" $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for" $proxy_x_request_id'; -access_log /dev/stdout main; +log_format main_json escape=json + '{' + '"body_bytes_sent":"$body_bytes_sent",' + '"host":"$host",' + '"http_referrer":"$http_referer",' + '"http_user_agent":"$http_user_agent",' + '"http_x_forwarded_for":"$http_x_forwarded_for",' + '"proxy_x_forwarded_port":"$proxy_x_forwarded_port",' + '"proxy_x_forwarded_proto":"$proxy_x_forwarded_proto",' + '"proxy_x_forwarded_ssl":"$proxy_x_forwarded_ssl",' + '"proxy_x_request_id":"$proxy_x_request_id",' + '"remote_addr":"$remote_addr",' + '"remote_user":"$remote_user",' + '"request":"$request",' + '"request_length":"$request_length",' + '"request_time":"$request_time",' + '"status": "$status",' + '"time_iso8601":"$time_iso8601"' + '}'; + +access_log /dev/stdout main_json; error_log /dev/stdout warn;