@@ -23,12 +23,26 @@ http {
2323 gzip_comp_level 2;
2424 gzip_min_length 512;
2525
26- log_format l2met 'measure#nginx.service=$request_time request_id=$http_x_request_id '
27- '$http_x_forwarded_for - $remote_user [$time_local] '
28- '"$request" $status $bytes_sent '
29- '"$http_referer" "$http_user_agent" "$gzip_ratio"';
26+ log_format json escape=json '{"status":$status,'
27+ '"time":"$time_iso8601",'
28+ '"method":"$request_method",'
29+ '"uri":"$request_uri",'
30+ '"srv":"$server_name",'
31+ '"vhost":"$host",'
32+ '"ip":"$remote_addr",'
33+ '"xff":"$http_x_forwarded_for",'
34+ '"size":$body_bytes_sent,'
35+ '"reqsize":$request_length,'
36+ '"runtime":"$upstream_http_x_runtime",'
37+ '"apptime":$upstream_response_time,'
38+ '"reqtime":$request_time,'
39+ '"id":"$http_x_request_id"}';
40+
41+ log_format csp_report escape=json '{"type":"csp",'
42+ '"time":"$time_iso8601",'
43+ '"id":"$http_x_request_id",'
44+ '"csp_report":"$request_body"}';
3045
31- log_format csp_report 'measure#nginx.service=$request_time request_id=$http_x_request_id xff=$http_x_forwarded_for referer="$http_referer" ua="$http_user_agent" csp.report=$request_body';
3246 map $status $csp_loggable {
3347 "200" 1;
3448 default 0;
5670 default 1;
5771 }
5872
59- access_log <%= stdout %> l2met ;
73+ access_log <%= stdout %> json ;
6074 error_log <%= platform == 'heroku' ? 'logs/nginx/access.log' : '/dev/stderr' %> ;
6175
6276 include mime.types;
8498 }
8599
86100 location = /_csp {
101+ client_max_body_size 2k;
102+
87103 if ($request_method != "POST") {
88104 return 405;
89105 }
@@ -145,7 +161,7 @@ http {
145161 listen <%= ENV . fetch ( "PORT" ) %> ;
146162 server_name <%= jump_host %> ;
147163
148- access_log <%= stdout %> l2met if=$loggable_error;
164+ access_log <%= stdout %> json if=$loggable_error;
149165 default_type text/plain;
150166
151167 location = /healthz {
0 commit comments