How to install GoAccess in Ubuntu

Installation of GoAccess in Ubuntu

GoAccess is an open source web log analyzer program which analyzes and check the web server logs rapidly. It allow system administrators to have a fast and valuable HTTP statistics which require a visual server report. Installation of GoAccess in Ubuntu is explained in this article.

Features

  • It parses the specified web log file and outputs the data to the X terminal
  • It allows any custom log format string
  • It is able to rapidly analyze and view web server statistics in real time without having to generate an HTML report.

To Install GoAccess

To update the packages, use “ apt-get” command.

user1@linuxhelp:~$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  apt apt-transport-https apt-utils bsdutils compiz compiz-core compiz-gnome
  compiz-plugins-default file-roller fonts-opensymbol fwupd glib-networking
  glib-networking-common glib-networking-services grep indicator-bluetooth
  initramfs-tools initramfs-tools-bin initramfs-tools-core
  language-selector-common language-selector-gnome libapt-inst2.0
  libapt-pkg5.0 libblkid1 libcompizconfig0 libdecoration0 libdfu1
  libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2
  libfdisk1 libfwupd1 libglib2.0-0 libglib2.0-bin libglib2.0-data
  libmetacity-private3a libmount1 libnm-glib-vpn1 libnm-glib4 libnm-gtk-common
  libnm-gtk0 libnm-util2 libnm0 libnma-common libnma0
  libreoffice-avmedia-backend-gstreamer libreoffice-base-core libreoffice-calc
  libreoffice-common libreoffice-core libreoffice-draw libreoffice-gnome
  libreoffice-gtk libreoffice-help-en-us libreoffice-impress libreoffice-math
  libreoffice-ogltrans libreoffice-pdfimport libreoffice-data-style-breeze
  libreoffice-data-style-galaxy libreoffice-writer libsmartcols1
  libunity-control-center1 libunity-core-6.0-9 libupower-glib3 libuuid1 lshw
  metacity-common mount mtr-tiny mysql-client-5.7 mysql-client-core-5.7
.
.
.
Setting up libreoffice-help-en-us (1:5.1.3-0ubuntu1) ...
Setting up unity-control-center (15.04.0+16.04.20160413-0ubuntu3) ...
Setting up indicator-bluetooth (0.0.6+16.04.20160526-0ubuntu1) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Processing triggers for initramfs-tools (0.122ubuntu8.1) ...
update-initramfs: Generating /boot/initrd.img-4.4.0-24-generic

Install the “ build essential” package by using the following command.

user1@linuxhelp:~$ sudo apt-get install build-essential
[sudo] password for user1: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version (12.1ubuntu2).
build-essential set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Now install GoAccess dependency packages.

user1@linuxhelp:~$ sudo apt-get install libncursesw5-dev libglib2.0-dev libgeoip-dev libtokyocabinet-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  geoip-bin libpcre3-dev libpcre32-3 libpcrecpp0v5 libtinfo-dev
  libtokyocabinet9 zlib1g-dev
Suggested packages:
  libglib2.0-doc ncurses-doc
The following NEW packages will be installed:
  geoip-bin libgeoip-dev libglib2.0-dev libncursesw5-dev libpcre3-dev
  libpcre32-3 libpcrecpp0v5 libtinfo-dev libtokyocabinet-dev libtokyocabinet9
  zlib1g-dev
0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,401 kB of archives.
After this operation, 19.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
.
.
.
Setting up libtokyocabinet9:amd64 (1.4.48-10) ...
Setting up libtokyocabinet-dev (1.4.48-10) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...

Set up the build directory

Run the following command to define your directory and provide read, write and execute permissions.

user1@linuxhelp:~$ sudo chown $USER /usr/local/src
user1@linuxhelp:~$ sudo chmod u+rwx /usr/local/src

Go to the chosen directory.

user1@linuxhelp:~$ cd /usr/local/src
user1@linuxhelp:/usr/local/src$ 

To download and extract GoAccess source code

Run the following command to download GoAccess software.

user1@linuxhelp:/usr/local/src$ wget http://tar.goaccess.io/goaccess-0.8.5.tar.gz
--2016-06-23 04:23:20--  http://tar.goaccess.io/goaccess-0.8.5.tar.gz
Resolving tar.goaccess.io (tar.goaccess.io)... 107.170.196.4
Connecting to tar.goaccess.io (tar.goaccess.io)|107.170.196.4|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 189006 (185K) [application/x-gzip]
Saving to: ‘ goaccess-0.8.5.tar.gz’ 

goaccess-0.8.5.tar. 100%[===================> ] 184.58K  81.1KB/s    in 2.3s    

2016-06-23 04:23:24 (81.1 KB/s) - ‘ goaccess-0.8.5.tar.gz’  saved [189006/189006]
user1@linuxhelp:/usr/local/src$ ls -l
total 188
-rw-rw-r-- 1 user1 user1 189006 Jun 17 07:43 goaccess-0.8.5.tar.gz
user1@linuxhelp:/usr/local/src$

Extract the downloaded tar file by using the following command.

user1@linuxhelp:/usr/local/src$ tar -zxvf goaccess-0.8.5.tar.gz 
goaccess-0.8.5/
goaccess-0.8.5/browsers.h
goaccess-0.8.5/ChangeLog
goaccess-0.8.5/xmalloc.h
goaccess-0.8.5/config/
goaccess-0.8.5/config/goaccess.conf
goaccess-0.8.5/depcomp
goaccess-0.8.5/gdns.h
goaccess-0.8.5/README
goaccess-0.8.5/settings.h
goaccess-0.8.5/parser.c
goaccess-0.8.5/Makefile.am
goaccess-0.8.5/gdashboard.h
goaccess-0.8.5/commons.c
goaccess-0.8.5/error.h
.
.
.
goaccess-0.8.5/tcabinet.c
goaccess-0.8.5/csv.h
user1@linuxhelp:/usr/local/src$ 

Now Compile and install the source code within the extracted directory.

user1@linuxhelp:/usr/local/src$ cd goaccess-0.8.5/
user1@linuxhelp:/usr/local/src/goaccess-0.8.5$ 

Then execute the configure script.

user1@linuxhelp:/usr/local/src/goaccess-0.8.5$ ./configure -enable-geoip -enable-utf8
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for data-style of include used by make... GNU
checking dependency data-style of gcc... gcc3
checking for pthread_create in -lpthread... yes
checking for GeoIP_new in -lGeoIP... yes
checking for mvaddwstr in -lncursesw... yes
checking for ncursesw/ncurses.h... yes
.
.
.
Your build configuration:

  CFLAGS =  -pthread
  storage: On-memory Hash Database (GLib)
  prefix: /usr/local
  package: goaccess
  version: 0.8.5
  bugs: goaccess@prosoftcorp.com
user1@linuxhelp:/usr/local/src/goaccess-0.8.5$ 

Before the installation of the GoAccess, the makefile must be built by using the below command.

user1@linuxhelp:/usr/local/src/goaccess-0.8.5$ make
make  all-am
make[1]: Entering directory ' /usr/local/src/goaccess-0.8.5' 
gcc -DHAVE_CONFIG_H -I.    -O2 -DSYSCONFDIR=" /usr/local/etc"  -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Wno-long-long -Wall -W -Wnested-externs -Wformat=2 -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Wwrite-strings -Wshadow -Wpointer-arith -Wsign-compare -Wredundant-decls -Wbad-function-cast -Winline -Wcast-align -Wextra -Wdeclaration-after-statement -Wno-missing-field-initializers -pthread -MT browsers.o -MD -MP -MF .deps/browsers.Tpo -c -o browsers.o browsers.c
mv -f .deps/browsers.Tpo .deps/browsers.Po
gcc -DHAVE_CONFIG_H -I.    -O2 -DSYSCONFDIR=" /usr/local/etc"  -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Wno-long-long -Wall -W -Wnested-externs -Wformat=2 -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Wwrite-strings -Wshadow -Wpointer-arith -Wsign-compare -Wredundant-decls -Wbad-function-cast -Winline -Wcast-align -Wextra -Wdeclaration-after-statement -Wno-missing-field-initializers -pthread -MT commons.o -MD -MP -MF .deps/commons.Tpo -c -o commons.o commons.c
.
.
.
 settings.o ui.o util.o xmalloc.o  glibht.o geolocation.o -lm -lnsl -lglib-2.0 -lncursesw -lGeoIP -lpthread 
make[1]: Leaving directory ' /usr/local/src/goaccess-0.8.5' 
user1@linuxhelp:/usr/local/src/goaccess-0.8.5$

Run the following command to install GoAccess.

user1@linuxhelp:/usr/local/src/goaccess-0.8.5$ sudo make install
make[1]: Entering directory ' /usr/local/src/goaccess-0.8.5' 
 /bin/mkdir -p ' /usr/local/bin' 
  /usr/bin/install -c goaccess ' /usr/local/bin' 
 /bin/mkdir -p ' /usr/local/etc' 
 /usr/bin/install -c -m 644 config/goaccess.conf ' /usr/local/etc' 
 /bin/mkdir -p ' /usr/local/share/man/man1' 
 /usr/bin/install -c -m 644 goaccess.1 ' /usr/local/share/man/man1' 
make[1]: Leaving directory ' /usr/local/src/goaccess-0.8.5' 

Edit the GoAccess config file using your favourite editor.

user1@linuxhelp:/usr/local/src/goaccess-0.8.5$ sudo vim /usr/local/etc/goaccess.conf 

Uncomment the “ date-format” line as shown below.

Then uncomment “ log-format” line.


Login to the root user using ssh.

user1@linuxhelp:/usr/local/src/goaccess-0.8.5$ ssh root@192.168.7.177
root@192.168.7.177' s password: 
Welcome to Ubuntu 16.04 LTS (GNU/Linux 4.4.0-24-generic x86_64)

* Documentation:  https://help.ubuntu.com/

0 packages can be updated.
0 updates are security updates.

*** System restart required ***

The programs included with the Ubuntu system are free software 
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

To Locate the log files

To check all the contents of this directory, use the following command

root@linuxhelp:~# ls /var/log/apache2/
access.log  error.log  other_vhosts_access.log

To Run GoAccess

The following command will enable you to run GoAccess on your Apache server.

root@linuxhelp:~# goaccess -f /var/log/apache2/access.log -a

Then the GoAccess dashboard will appear.

Press " f1" for help.

To view the available option for active model press " s" .

)

GoAccess dashboard options

  • The selected module on the dashboard could be expanded using the “ o” or “ enter” .
  • “ j” is used to scroll down under an expanded active module.
  • “ k” is used to scroll back up under the expanded active module.
  • To view the set of all available options for the active module, use “ s” key.
  • “ q” is used to exit the program/window.
  • “ g” is used to scroll to the last item of the dashboard screen.
  • “ F5” as it is known is used to refresh and redraw the dashboard.
Tag : GoAccess
FAQ
Q
What are all the GoAccess dependency packages?
A
Go Access dependency packages are

libncursesw5-dev libglib2.0-dev libgeoip-dev libtokyocabinet-dev
Q
where i can find the official page for goaccess?
A
You can find the official page of goaccess from the link https://goaccess.io/
Q
I need to try go access without install. is there any way around?
A
you can use go access live, go to this link https://rt.goaccess.io/?20180613194436
Q
What is the alternative for goaccess?
A
you can try Matomo, AWStats, The Webalizer as an alternative to go access
Q
how to install goaccess on centos ?
A
To install goaccess on centos follow this link, https://www.linuxhelp.com/how-to-install-goaccess-in-centos-7/