Remove logging prefix from Nginx logs

Problem: The JSON that Nginx outputs cannot be successfully parsed by
journaldriver because Nginx prefixes it with "socrates nginx:". Adding
`nohostname` to `access_log` should solve this problem.

I borrow this from @tazjin's most recent definition of `commonHttpConfig`.
This commit is contained in:
William Carroll 2020-08-14 11:17:47 +01:00
parent 2eb52379b6
commit 979cbda33c

View file

@ -168,17 +168,18 @@ in {
commonHttpConfig = '' commonHttpConfig = ''
log_format json_combined escape=json log_format json_combined escape=json
'{' '{'
'"time_local":"$time_local",'
'"remote_addr":"$remote_addr",' '"remote_addr":"$remote_addr",'
'"remote_user":"$remote_user",' '"method":"$request_method",'
'"request":"$request",' '"uri":"$request_uri",'
'"status": "$status",' '"status":$status,'
'"body_bytes_sent":"$body_bytes_sent",' '"request_size":$request_length,'
'"request_time":"$request_time",' '"response_size":$body_bytes_sent,'
'"http_referrer":"$http_referer",' '"response_time":$request_time,'
'"http_user_agent":"$http_user_agent"' '"referrer":"$http_referer",'
'"user_agent":"$http_user_agent"'
'}'; '}';
access_log syslog:server=unix:/dev/log json_combined;
access_log syslog:server=unix:/dev/log,nohostname json_combined;
''; '';
virtualHosts = { virtualHosts = {