Analyse App Traffic with GoAccess

Manually going through access and error logs are not only tiring but makes no sense. In this article, I will show you a way to visualize traffic usage with GoAccess.

Install GoAccess (step below is only for Debian/Ubuntu)

apt-get install goaccess

Not using Debian/Ubuntu? You can find out more here

Now, cd to nginx's log directory

cd /var/log/nginx

You can read a log using the following command:

goaccess access.log -c --log-format=COMBINED

Now, nginx defaults to zipping previous logs, you can do some magic via:

for i in $(seq 10); do gzip -c access.log.${i}.gz & done | goaccess -c --log-format=COMBINED -

This will unzip the logs, and pipe all the data into goaccess. goaccess will read STDIN(or pipe) if given a -.

my image

Piping dokku logs into GoAccess

First, we can access dokku's logs via the command:

dokku nginx:access-log <app-name>

with that knowledge, we can pipe the output into GoAccess with:

dokku nginx:access-log <app-name> -t | goaccess -c --log-format=COMBINED -

Don't forget to include the - at the end!