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
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
Modify the config file to accept nginx log
sudo vi sudo vi /etc/goaccess/goaccess.confΒ
Uncomment the following lines:
time-format %H:%M:%S
date-format %d/%b/%Y
log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u"
Run goaccess to show realtime nginx log
sudo goaccess /var/log/nginx/access.log
Generate report in html
format.
sudo goaccess /var/log/nginx/access.log -o report.html --log-format=COMBINED
I hope this article will help anyone who needs to analyze nginx report.
Top comments (0)