Skip to content

Commit

Permalink
Merge pull request #6 from Intellection/log_format_improvements
Browse files Browse the repository at this point in the history
Log format improvements
  • Loading branch information
itskingori authored Feb 10, 2021
2 parents caa3c62 + c2b081f commit 2c9b4cb
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`.
Expand Down
29 changes: 25 additions & 4 deletions config/log.conf
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 2c9b4cb

Please sign in to comment.