# Goaccess log format

**URL:** https://meta.discourse.org/t/goaccess-log-format/301134
**Category:** Support
**Created:** [March 27, 2024, 11:08am UTC](https://meta.discourse.org/t/goaccess-log-format/301134 "2024-03-27T11:08:02Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Andro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/andro/32/173721_2.png) [@Andro](https://meta.discourse.org/u/Andro)
#### Post date: [March 27, 2024, 11:08am UTC](https://meta.discourse.org/t/goaccess-log-format/301134/1 "2024-03-27T11:08:02Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Andro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/andro/32/173721_2.png) [@Andro](https://meta.discourse.org/u/Andro)
#### Post date: [March 27, 2024, 1:11pm UTC](https://meta.discourse.org/t/goaccess-log-format/301134/2 "2024-03-27T13:11:38Z")

</div>

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:

[https://github.com/stockrt/nginx2goaccess](https://github.com/stockrt/nginx2goaccess)

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.

[GoAccess - Visual Web Log Analyzer](https://goaccess.io/)
