goaccess for nginx report

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.



Source link
lol

By stp2y

Leave a Reply

Your email address will not be published. Required fields are marked *

No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.