We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to configure nginx to produce only struct log so that logagg can pick them up?
The text was updated successfully, but these errors were encountered:
To get the nginx logs in json format we have to modify the nginx.conf file in /etc/nginx directory.
nginx.conf
/etc/nginx
Modify the Logging Settings section in the nginx.conf file by adding the below lines:
Logging Settings
## # Logging Settings ## log_format json '{' '"remote_addr": "$remote_addr",' '"remote_user": "$remote_user",' '"timestamp": "$msec",' '"request": "$request",' '"status": "$status",' '"request_time": "$request_time",' '"body_bytes_sent": "$body_bytes_sent",' '"http_referer": "$http_referer",' '"http_user_agent": "$http_user_agent",' '"http_x_forwarded_for": "$http_x_forwarded_for",' '"upstream_response_time": "$upstream_response_time"' '}'; access_log /var/log/nginx/access.log json; error_log /var/log/nginx/error.log;
Modify the line: access_log /var/log/nginx/access.log; to access_log /var/log/nginx/access.log json;
access_log /var/log/nginx/access.log;
access_log /var/log/nginx/access.log json;
To test nginx config file
nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
/etc/init.d/nginx restart
Sorry, something went wrong.
supriyopaul
No branches or pull requests
How to configure nginx to produce only struct log so that logagg can pick them up?
The text was updated successfully, but these errors were encountered: