Slide 31
Slide 31 text
log_format upstream_log '$time_local -> $remote_addr -> $server_name - $upstream_addr - '
'$http_user_agent - $bytes_sent/$upstream_bytes_received - "$request" $status - '
'$request_time/$upstream_response_time';
access_log /var/log/nginx/access.log upstream_log buffer=64k flush=5s;
log_format logger_json escape=json '{"time": $msec, "address": "$remote_addr", "server_name": "$server_name",'
'"upstream_addr": "$upstream_addr", "user_agent": "$http_user_agent",'
'"bytes_sent": $bytes_sent, "upstream_bytes_received": $upstream_bytes_received,'
'"method": "$request_method", "uri": "$request_uri", "host": "$http_host",'
'"status": $status,"request_length": $request_length, "resp_time": $request_time,'
'"upstream_response_time": $upstream_response_time }';
access_log /var/log/nginx/access.log logger_json buffer=64k flush=5s;
Json
Human
Logging
server {
location /demo/ {
access_log off;
proxy_pass http://my_service;
}
}
Disable Logs
On a Specific Path