Does anybody have a log file format for goaccess log file analyzer that works for the nginx logs produced by Discourse docker installation? I am having difficulty writing it.
Well, answering my own question…
The log file format in the docker container is:
log_format log_discourse ‘[$time_local] “$http_host” $remote_addr “$request” “$http_user_agent” “$sent_http_x_discourse_route” $status $bytes_sent “$http_referer” $upstream_response_time $request_time “$upstream_http_x_discourse_username” “$upstream_http_x_discourse_trackview” “$upstream_http_x_queue_time” “$upstream_http_x_redis_calls” “$upstream_http_x_redis_time” “$upstream_http_x_sql_calls” “$upstream_http_x_sql_time”’;
There’s a utility script that can parse this and produce the .goaccess log file format at github:
Here’s the output:
time-format %T
date-format %d/%b/%Y
log_format [%d:%t %^] “%v” %h “%r” “%u” “%^” %s %b “%R” %^ %T “%^” “%^” “%^” “%^” “%^” “%^” “%^”
Quite hard to write that yourself. I thought this may be useful for others in the future.
The goaccess program is a very nice log file analyzer.