How to install GoAccess Apache Log Analyzer Tool on linuxmint 18.03
Installation of GoAccess Apache Log Analyzer Tool on linuxmint 18.03
GoAccess is a free, open source and real time web server log analyzer tool that can be used to analyze and view web server logs. GoAccess is based on command line and also produces HTML reports that can be viewed through a web browser. It has several features including, General Statistics, bandwidth, Different Color Schemes, Top Visitors, Referring Sites & URLs, Operating Systems, Browsers, Metrics per Virtual Host and much more.
Installation
Let's First Check the status of apache using the following command
linuxhelp ~ # systemctl status apache2
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: active (running) since Wed 2018-09-19 14:11:52 IST; 3 months 29 days ago
Docs: man:systemd-sysv-generator(8)
CGroup: /system.slice/apache2.service
├─3535 /usr/sbin/apache2 -k start
├─3538 /usr/sbin/apache2 -k start
└─3539 /usr/sbin/apache2 -k start
Sep 19 14:11:51 linuxhelp systemd[1]: Starting LSB: Apache2 web server...
Sep 19 14:11:51 linuxhelp apache2[3513]: * Starting Apache httpd web server apache2
Sep 19 14:11:51 linuxhelp apache2[3513]: AH00557: apache2: apr_sockaddr_info_get() failed for lin
Sep 19 14:11:51 linuxhelp apache2[3513]: AH00558: apache2: Could not reliably determine the serve
Sep 19 14:11:52 linuxhelp apache2[3513]: *
Sep 19 14:11:52 linuxhelp systemd[1]: Started LSB: Apache2 web server.
Sep 19 14:12:28 linuxhelp systemd[1]: Started LSB: Apache2 web server.
And then add the GoAccess repository to the APT. You can do this with the following command
linuxhelp ~ # echo "deb http://deb.goaccess.io/ $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/goaccess.list
sudo: unable to resolve host linuxhelp
deb http://deb.goaccess.io/ sylvia main
Download the apt key run the following command,
linuxhelp ~ # wget -O - https://deb.goaccess.io/gnugpg.key | sudo apt-key add –
sudo: unable to resolve host linuxhelp
--2019-01-18 04:31:23-- https://deb.goaccess.io/gnugpg.key
Resolving deb.goaccess.io (deb.goaccess.io)... 107.170.196.4
Connecting to deb.goaccess.io (deb.goaccess.io)|107.170.196.4|:443... gpg: can't open `–': No such file or directory
connected.
HTTP request sent, awaiting response... 200 OK
Length: 3121 (3.0K) [application/pgp-keys]
Saving to: ‘STDOUT’
- 0%[ ] 0 --.-KB/s in 0.002s
Cannot write to ‘-’ (Success).
update the repository using the following command
linuxhelp ~ # apt-get update
Hit:1 http://archive.canonical.com/ubuntu xenial InRelease
Hit:2 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:3 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:4 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Ign:5 http://packages.linuxmint.com sylvia InRelease
Get:6 http://deb.goaccess.io sylvia InRelease [2,519 B]
Hit:7 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Ign:6 http://deb.goaccess.io sylvia InRelease
Hit:8 http://packages.linuxmint.com sylvia Release
Get:10 http://deb.goaccess.io sylvia/main amd64 Packages [625 B]
Get:11 http://deb.goaccess.io sylvia/main i386 Packages [612 B]
Fetched 3,756 B in 1s (2,941 B/s)
Reading package lists... Done
W: GPG error: http://deb.goaccess.io sylvia InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 742483B7B222C443
W: The repository 'http://deb.goaccess.io sylvia InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Finally, install GoAccess by running the following command
linuxhelp ~ # apt-get install goaccess
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
goaccess
0 upgraded, 1 newly installed, 0 to remove and 485 not upgraded.
Need to get 275 kB of archives.
After this operation, 793 kB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
goaccess
Install these packages without verification? [y/N] y
Get:1 http://deb.goaccess.io sylvia/main amd64 goaccess amd64 1:1.3 [275 kB]
Fetched 275 kB in 2s (124 kB/s)
Selecting previously unselected package goaccess.
(Reading database ... 221562 files and directories currently installed.)
Preparing to unpack .../goaccess_1%3a1.3_amd64.deb ...
Unpacking goaccess (1:1.3) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up goaccess (1:1.3) ...
Now access your Apache web server using the URL http://your-server-ip.
After accessing the Web server, Apache will add some log entries in the default access_log file.
Now, you can analyze the Apache web server log from a terminal using the following command
linuxhelp ~ # goaccess /var/log/apache2/access.log --log-format=COMBINED
If you want to access your browser, You can also generate an HTML report with the following command
linuxhelp ~ # goaccess /var/log/apache2/access.log --log-format=COMBINED -a -o /var/www/html/report.html
Once the report is generated, open your web browser and type the URL http://your-server-ip/report.html
. You should see the report generated by GoAccess in the following image:
There are several ways to set the log format. If you are outputting to a terminal (ncurses), the easiest is to run GoAccess with -c.
# goaccess access.log -c
You could also specify the log format in the command line, so for the standard Apache/Nginx format, you could run:
# goaccess access.log --log-format=COMBINED
However any of those options won't make it permanent, for that you will need to specify the format in the configuration file.
libGeoIP-devel | GeoIP2 C library
libncurses-devel | Terminal display library
libncursesw10 | Terminal display library (wide-character)
gcc-core (C) | GNU Compiler Collection
make | make utility
automake | GNU Makefiles
gettext | GNU Gettext
gettext-devel | GNU Gettext
automake wrapper scripts | wrapper scripts for automake and aclocal
GoAccess' benchmark — Intel(R) Core(TM) i7-4510U CPU @ 2.00GHz 8GB RAM
Benchmark (v1.2) - Default Hash Tables 51,394 lines per second
Benchmark (v1.2) - On-Disk B+ Tree 12,805 lines per second
Benchmark full features & metrics enabled (>=v0.9.5) - In-memory hash table 27,296 lines per second