goaccess

Define a specific log format in .goaccessrc


I'm reading the goaccess man page but I'm missing simple examples. I have a customised nginx with the following config:

log_format timed_combined '$remote_addr - $remote_user [$time_local] '
    '$ssl_protocol/$ssl_cipher '
    '"$request" $status $body_bytes_sent '
    '"$http_referer" "$http_user_agent" '
    '$request_time $upstream_response_time $pipe';

Here is an example log entry:

66.249.76.120 - - [20/Dec/2016:19:04:03 +0100] 
TLSv1.2/ECDHE-RSA-AES128-GCM-SHA256 "GET / HTTP/1.1" 200 27232 
"-" "Mozilla/5.0 (compatible; Googlebot/2.1; 
+http://www.google.com/bot.html)" 0.026 0.026 .

How do I have to configure the .goaccessrc to read that format?


Solution

  • You can add this to your config file or ~/.goaccessrc

    log-format %h %^[%d:%t %^] %^"%r" %s %b "%R" "%u" %T %^
    date-format %d/%b/%Y
    time-format %H:%M:%S