Generate access log report using goaccess
We can install Goaccess on server which can be used to generate real time statics of Nginx access logs. Installation steps:
# echo "deb http://deb.goaccess.io $(lsb_release -cs) main" | tee -a /etc/apt/sources.list
# wget -O - http://deb.goaccess.io/gnugpg.key | apt-key add -
# apt-get update
# apt-get install goaccess
Configuration Steps: edit following file
vim /etc/goaccess.conf +21
and add following:
time-format %H:%M:%S
date-format %d/%b/%Y
log-format %h %^[%d:%^] %^"%r" %s %b "%R" "%u"
Goaccess generates output in HTML format also which we can store inside 22222 port Sample: http://goaccess.io/goaccess_html_report.html?20150319 HTML output generation:
goaccess -f /var/log/nginx/example.com.access.log -a > report.html
:100: :+1: Awesome
Might want to include the log format required to parse the ee nginx log.
http://community.rtcamp.com/t/cant-parse-the-access-log-with-goaccess/4127/4
Does this one work from the above thread: %h %D %^ [%d:%^] %^ "%r" %s %b "%R" "%u"
@cm896 ,Thanks for pointing, updated issue
@gau1991 - yw. I like this, just figuring out how I can use it, or automate the reports.
I realize goaccess is a real time log reporting tool but can also be used as a report output tool.
- setup the ee nginx logs for each domain to rotate daily?
- setup a cron job that parses and outputs each domain's daily log to a daily report to the :22222 admin section /logs/domainname/date?
Ideas on how this would be implemented?
I am not sure how to make this workflow happen otherwise. If I have to ssh into the box to kick off the report, I might as well just use the real time viewer at that point, no? I also wonder about such log file sizes, especially since my normal access log file is almost always larger than 1.5gb before being rotated. Their faq states the beefy computer (w/8gb memory scenario) can parse around 50k lines a second. I have a 1.5gb current log which has 4637639 lines. Best case scenario is this parsing taking 92 seconds to parse my example log.
@gau1991 @cm896
We can generate report for sites before logrotate runs.
Logs are managed differently in docker
log-format %h %D %^ [%d:%t %^] %^ "%r" %s %b "%R" "%u"