How to install SARG on Ubuntu 16.04

To install SARG on Ubuntu 16.04

SARG means Squid Analysis Report Generator.SARG is a Internet Bandwidth Monitoring tool. It is an open source tool that allows you to analyze the squid log files and generates reports in HTML format with information about users, IP addresses, top accessed sites, elapsed time, downloads, access denied websites, daily reports, weekly reports and monthly reports. The SARG is widely used to check how the internet bandwidth is utilized by individual machines on the same network. This tutorial covers the installation of SARG on Ubuntu 16.04. 

 

Pre-Requisite

Before starting the installation procedure, install and configure Squid in your system by following the steps on the tutorial https://www.linuxhelp.com/how-to-install-and-configure-squid-part-1/

 

Installation procedure

To proceed with the installation procedure, install the Apache service by executing the following command. 

root@linuxhelp:~#  apt-get install apache2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gnome-software-common libgtkspell3-3-0
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
.
.
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (229-4ubuntu4) ...
Processing triggers for ufw (0.35-0ubuntu2) ...

Start the Apache service

root@linuxhelp:~# systemctl start apache2

Next install SARG by executing the following command and press y to continue with the installation process. 

root@linuxhelp:~# apt-get -y install sarg
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gnome-software-common libgtkspell3-3-0
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  squidguard libapache2-mod-php5
The following NEW packages will be installed:
  Sarg
.
.
Unpacking sarg (2.3.10-2) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up sarg (2.3.10-2) ...

Edit the SARG configuration file using vim editor and make the required changes in the file and save it. 

root@linuxhelp:~#  vim /etc/sarg/sarg.conf
# line 120,121: uncomment and comment out
output_dir /var/www/html/squid-reports
#output_dir /var/lib/sarg
# line 132: add
resolve_ip yes
# line 377: change
charset UTF-8

Create the squid-report directory in the Apache Directory. 

root@linuxhelp:~#  mkdir /var/www/html/squid-reports

Create the virtual host for SARG by executing the following command. Enter the following content in the file and save it. 

root@linuxhelp:~#  vi /etc/apache2/conf-available/sarg.conf

<VirtualHost *:80>
    DocumentRoot /var/www/html/squid-reports/
    ServerName sarg.org
        <Directory /var/www/html/squid-reports/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Require all granted
        </Directory>
        </VirtualHost>

To run the SARG application, execute the following command. 

root@linuxhelp:~# a2enconf sarg

Restart the Apache service. 

root@linuxhelp:~# systemctl restart apache2

Edit the hosts file and enter the following content in the file. Save and exit the file. 

root@linuxhelp:~# vi /etc/hosts
192.168.7.139    sarg.org

To generate log details, execute the following command. 

root@linuxhelp:~# /usr/bin/sarg

Switch over to the browser and enter the URL as http://sarg.org. The SARG will be appeared on the screen. Click on the displayed file. 

a

It opens the log files of all squid users. To view particular user details click the userID. 
b

The window shows the list of users details
c
d

To view denied access to particular users., click denied access in the home page. 
e

This displayed list shows denied access of the users. 
f

To view only sites and users list, click sites&user option. 
a


b

To view top 100 sites accessed by users, click top sites option. 
a
a
a

To view the reports in graphical view, click graphic icon in the home page. 
b


a

To view the reports in tabular view, click tabular icon. 
b

d

Thus concludes the installation procedure of SARG on Ubuntu 16.04


Thank you! for using Linux Help.

You find this tutorial helpful? Share with your friends to keep it alive.
For more help topics browse our website www.linuxhelp.com
Be the first to comment, we value your suggestions. For further queries please comment below.

Tags: Network Monitoring Ubuntu
user image Author :  Grayson