ngxtop icon indicating copy to clipboard operation
ngxtop copied to clipboard

Custom logformat

Open AlroneRhyn opened this issue 8 years ago • 2 comments

Hi !

I enconter an issue with a custum access log format :

$ ngxtop -c /etc/nginx/site-available/unicorn.conf Error: Incorrect format name set in config for access log file "blablabla/access_log" My Nginx vhost : access_log blablabla/access_log vhosts

And my log format is : log_format vhosts '$host $remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"';

Thanks a lot !

AlroneRhyn avatar May 25 '16 09:05 AlroneRhyn

cat /usr/local/nginx/conf/vhost/qiye.glq.com.conf log_format access2 '$remote_addr - $remote_user [$time_local] $host ' '"$request" $status $body_bytes_sent "$request_body" $request_time ' '"$http_referer" "$http_user_agent" $http_x_forwarded_for ' '$upstream_addr $upstream_response_time'; server { listen 80; server_name qiye.glq.com; index index.html index.htm index.php; root /data/web/qiye.glq.com/; access_log /data/wwwlogs/qiye.glq.com.log access2;

you know what I mean?

gaolongquan avatar Aug 30 '16 02:08 gaolongquan

Hi, I'm managing a nginx server with multiple website configurations, so I've different access log file for every website and I created a unique file with all the access requests to parse it with ngxtop.

Now I'm trying to create a custom format to show in ngxtop request_path field the full path of the request because, with default combined format, it shows only the relative path of the requested resource and I cannot understand for which website the request was made.

I tried this "brutal approach" creating this custom log_format:

log_format ngxtop_total '$http_referer - $remote_user [$time_local] '
                    '"$http_referer" $status $body_bytes_sent '
                    '"$http_referer" "$http_user_agent"';

modifing all the entries with the $http_referer, that includes the full path, but ngxtop is not showing any more the request_path field.

I can I solve this problem? Thanks Bye

mascor avatar Jan 19 '18 11:01 mascor