about summary refs log tree commit diff
path: root/nixos/socrates
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-08-14T10·17+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-08-20T10·26+0100
commit979cbda33c909d3bb2c7e642df6ccf70a76c1aa8 (patch)
tree1bc3d35617a43fc864812f95784080523a31fe2c /nixos/socrates
parent2eb52379b6a9c77ea99b194658be9d634f09dfb8 (diff)
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`.
Diffstat (limited to 'nixos/socrates')
-rw-r--r--nixos/socrates/configuration.nix19
1 files changed, 10 insertions, 9 deletions
diff --git a/nixos/socrates/configuration.nix b/nixos/socrates/configuration.nix
index 7c0bedb83159..2fb7b5b58f89 100644
--- a/nixos/socrates/configuration.nix
+++ b/nixos/socrates/configuration.nix
@@ -168,17 +168,18 @@ in {
     commonHttpConfig = ''
       log_format json_combined escape=json
       '{'
-          '"time_local":"$time_local",'
           '"remote_addr":"$remote_addr",'
-          '"remote_user":"$remote_user",'
-          '"request":"$request",'
-          '"status": "$status",'
-          '"body_bytes_sent":"$body_bytes_sent",'
-          '"request_time":"$request_time",'
-          '"http_referrer":"$http_referer",'
-          '"http_user_agent":"$http_user_agent"'
+          '"method":"$request_method",'
+          '"uri":"$request_uri",'
+          '"status":$status,'
+          '"request_size":$request_length,'
+          '"response_size":$body_bytes_sent,'
+          '"response_time":$request_time,'
+          '"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 = {