Thursday, July 6, 2017

How to install Web Log Analyzer - GoAccess

GoAccess is an open source real-time web log analyzer and interactive viewer that runs in a terminal or through your browser.

It provides fast and valuable HTTP statistics for system administrators that require a visual server report on the fly.

Installation instructions:

# wget http://tar.goaccess.io/goaccess-1.1.1.tar.gz

$ wget http://tar.goaccess.io/goaccess-1.1.1.tar.gz
$ tar -xzvf goaccess-1.1.1.tar.gz
$ cd goaccess-1.1.1/
$ ./configure --enable-geoip --enable-utf8
$ make
# make install

command to analyze log file:
# goaccess -f /var/log/httpd/access_log



You will be prompted to select the log format. If you are using a default server with the standard log file output, select the NCSA combined log format.

Press the Enter key and GoAccess will begin to analyze your log file. Once it is fully parsed, you will be redirected to the following command line interface.

Configure unattended startup

find the parameters that correspond to your log format and uncomment them in /usr/local/etc/goaccess.conf

vi /usr/local/etc/goaccess.conf
time-format %H:%M:%S
date-format %d/%b/%Y
log-format %h %^[%d:%^] "%r" %s %b

Start GoAccess with HTML Generation
To enable live reporting, simply issue the following command. This will output statsreport.html at the root of the /var/www/html directory. You may output it in any folder served by your Apache instance so that you can view the HTML file:

# goaccess -f /var/log/httpd/access_log -a -o /var/www/html/statsreport.html



For real time html output:
add option --real-time-html
# goaccess -f /var/log/httpd/access_log -a -o /var/www/html/statsreport.html  --real-time-html

In order to view the generated HTML report, simply navigate to report.html using your web browser.




To generate a CSV file:
# goaccess access.log --no-csv-summary -o report.csv

That's it....