How to custom my nginx log format?
ihaolin opened this issue · 3 comments
Hello,
My nginx log is defined, like :
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" $request_length $request_time $bytes_sent '
'"$upstream_cache_status"';
What should I use ngxtop with this log_format, I don't discover an option for this situation.
Thanks & Regards
I believe I'm having the same issue. I tried running
ngxtop -c /etc/nginx/conf.d/my-virtual-host
which uses the 'main' custom log format (defined in /etc/nginx/nginx.conf on CentOS6), but ngxtop responds with "Incorrect format name set in config for access log file".
If I run
ngxtop -l /path/to/my/access.log
which uses this 'main' format, ngxtop reports no statistics at all.
If I copy the 'log_format main ...' line from /etc/nginx/nginx.conf in to my virtual host config file, and then try running it with the -c flag again, it works as expected. So does that mean ngxtop is ignoring the log file formats defined in the 'http' section of /etc/nginx/nginx.conf? Or am I misunderstanding how this is supposed to work?
A lot of issue with custom access log format.
Error: Incorrect format name set in config for access log file "/data/logs/httpxxx.vn"
I believe I'm having the same issue. I tried running
ngxtop -c /etc/nginx/conf.d/my-virtual-host
which uses the 'main' custom log format (defined in /etc/nginx/nginx.conf on CentOS6), but ngxtop responds with "Incorrect format name set in config for access log file".
If I run
ngxtop -l /path/to/my/access.log
which uses this 'main' format, ngxtop reports no statistics at all.
If I copy the 'log_format main ...' line from /etc/nginx/nginx.conf in to my virtual host config file, and then try running it with the -c flag again, it works as expected. So does that mean ngxtop is ignoring the log file formats defined in the 'http' section of /etc/nginx/nginx.conf? Or am I misunderstanding how this is supposed to work?
how to 'copy the 'log_format main ...' line from /etc/nginx/nginx.conf in to my virtual host config file'