DEV Community

sugiarto
sugiarto

Posted on

goaccess for nginx report

Ever wondering to read nginx access log as a report? Yeah, we can easily read the nginx log file using this command.

tail -f /var/log/nginx/access.log
Enter fullscreen mode Exit fullscreen mode

But how about if we want to analyze the access.log file as a single report? I found goaccess can help to the rescue. So here is how I used this tool to generate a report.

I used Ubuntu 22.04, so the commands may need to be adjusted for different OS.

install goaccess

sudo apt-get install goaccess
Enter fullscreen mode Exit fullscreen mode

Modify the config file to accept nginx log

sudo vi sudo vi /etc/goaccess/goaccess.conf 
Enter fullscreen mode Exit fullscreen mode

Uncomment the following lines:

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

Run goaccess to show realtime nginx log

sudo goaccess /var/log/nginx/access.log
Enter fullscreen mode Exit fullscreen mode

Generate report in html format.

sudo goaccess /var/log/nginx/access.log -o report.html --log-format=COMBINED
Enter fullscreen mode Exit fullscreen mode

I hope this article will help anyone who needs to analyze nginx report.

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay