Take a backup of your existing nginx.conf
before you make changes to it
cp /etc/nginx/nginx.conf /etc/nginx/backup_nginx.conf
Edit the NGINX configuration file (/etc/nginx/nginx.conf
by default) and use the log_format
directive to define the format of access logs.
Replace the existing/default log_format
with the below format
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for" $request_time '
nginx.conf
fileCheck your nginx logs to ensure that they are being logged in the above json format.