1

I am looking for a way to store that logs in a common format so they can easily be recognized and parsed by most tools.

I am interested about a format that is automatically recognized by goaccess tool and that it can support response time.

So far it seems that the default log settings are not recognized.

enter image description here

sorin
  • 8,016
  • 24
  • 79
  • 103

2 Answers2

4

Nginx by default will output a combined log format (NCSA).

GoAccess will automatically recognize it if you pick the first option from the configuration dialog (or permanently uncomment the NCSA Combined Log Format from your config file.)

If you are interested to log the request time, then you need to modify your nginx config file and add your custom log format:

vi /etc/nginx/nginx.conf

then add:

log_format timed_combined '$remote_addr - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent ' '"$http_referer" "$http_user_agent" ' '$request_time';

and change the access log to use the new format:

access_log /var/log/nginx/timed.log timed_combined;

and restart nginx

Make sure your access.log is now logging the request time. Then you can add %T to your goaccess log-format as:

log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u" %T
Kayla
  • 171
  • 1
  • 8
  • I added the response time a long time ago and now this explains with goaccess was not able to recognize the format. I guess none of the standard log formats supports the response time... it would be much easier to go for one of those than having to reconfigure noaccess again and again. – sorin Jun 30 '15 at 15:00
1

GoAccess says right on their page:

Apache/Nginx Common/Combined + VHosts

If your logs aren't parsing, then you'll need to look into the GoAccess logs and see what is wrong.

Additionally:

GoAccess allows any custom log format string.

So you may need to look into how to instruct the tool on your custom format.

EEAA
  • 109,363
  • 18
  • 175
  • 245