Change log format to JSON

This commit is contained in:
Mark Smith 2022-10-12 11:27:27 +08:00
parent a6fa94f239
commit b31a26b445
1 changed files with 4 additions and 2 deletions

View File

@ -10,8 +10,10 @@ StartServers 10
MaxRequestWorkers 10
MaxConnectionsPerChild 1000
# Logging configuration.
LogFormat "%t %h %{Host}i %l %u \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" dreamwidth
# Logging configuration. JSON format for cloudwatch.
LogFormat "{\"time\":\"%{%Y-%m-%d}tT%{%T}t.%{msec_frac}tZ\",\"process\":\"%D\",\"filename\":\"%f\",\"remoteIP\":\"%a\",\"host\":\"%V\",\"request\":\"%U\",\"query\":\"%q\",\"method\":\"%m\",\"status\":\"%>s\",\"userAgent\":\"%{User-agent}i\",\"referer\":\"%{Referer}i\"}" dreamwidth
# Don't log OPTIONS requests to the main log
SetEnvIf REQUEST_METHOD OPTIONS optionsreq
CustomLog /var/log/apache2/dreamwidth_access.log dreamwidth env=!optionsreq
CustomLog /var/log/apache2/dreamwidth_options.log dreamwidth env=optionsreq