1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| log_format json_combined escape=json '{"@timestamp":"$time_iso8601",' '"@source":"$server_addr",' '"@nginx_fields":{' '"remote_addr":"$remote_addr",' '"remote_user":"$remote_user",' '"body_bytes_sent":"$body_bytes_sent",' '"request_time":"$request_time",' '"status":"$status",' '"host":"$host",' '"uri":"$uri",' '"server":"$server_name",' '"port":"$server_port",' '"protocol":"$server_protocol",' '"request_uri":"$request_uri",' '"request_body":"$request_body",' '"request_method":"$request_method",' '"http_referrer":"$http_referer",' '"body_bytes_sent":"$body_bytes_sent",' '"http_x_forwarded_for":"$http_x_forwarded_for",' '"http_user_agent":"$http_user_agent",' '"upstream_response_time":"$upstream_response_time",' '"upstream_addr":"$upstream_addr",' '"req_header":"$req_header",' '"req_body":"$request_body",' '"resp_header":"$resp_header",' '"resp_body":"$resp_body"}}';```
修改完成后执行测试,并且重启生效 ```bash openresty -t openresty -s reload
|