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.

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

The window shows the list of users details.

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

This displayed list shows denied access of the users.

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


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


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


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

Thus concludes the installation procedure of SARG on Ubuntu 16.04

Comment
noyphonethasith
Jun 14 2018
Hi bro I have issue after install sarg followed your video on youtube step by step. the issue is the sarg report i doesn't report me daily. it report only 13 JUN to 14 June 2018 but i dont have 15 or 16 June 2018,
junoprima
Apr 03 2018
Hello i ask a question how can i find ip on /etc/host/ i install it on virtualMachine can't access to sarg
Add a comment
FAQ
Q
What is SARG Tool?
A
SARG means Squid Analysis Report Generator.SARG is an 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.
Q
How to implement the setup in my SUSE server?
A
Yes, you can setup Sarg Squid Analyzer in Suse Linux.
Q
Is SARG a free/opensource software?
A
SARG is a free and opensource software.
Q
How to install and configure squid on Centos?
A
To install and configure squid follow,
https://www.linuxhelp.com/how-to-install-and-configure-squid-part-1/
Q
How to install SARG on Centos?
A
To install SARG on centos follow,
https://www.linuxhelp.com/how-to-install-sarg-on-centos-7/