Howto SARG on Centos

Dec-15th-2010

How to SARG on Centos | Fedora | RedHat

Download sarg from below url:  http://sarg.sourceforge.net/sarg.php

I have downloaded below one and installing from source:

http://sourceforge.net/projects/sarg/files/sarg/sarg-2.3.1/sarg-2.3.1.tar.gz/download

[root@linuxbox opt]# tar -zxvf sarg-2.3.1.tar.gz
[root@linuxbox opt]# cd sarg-2.3.1/
[root@linuxbox sarg-2.3.1]# ./configure
[root@linuxbox sarg-2.3.1]# make
[root@linuxbox sarg-2.3.1]# make install

Main sarg configuration file: /usr/local/etc/sarg.conf

[root@linuxbox ~]# vim /usr/local/etc/sarg.conf
# This is sample configuration, that you need to setup

access_log /var/log/squid/access.log
graphs yes
graph_days_bytes_bar_color orange
title “Squid User Access Reports”
temporary_dir /tmp
output_dir /var/www/html/reports/

[root@linuxbox ~]# vi /etc/httpd/conf.d/sarg.conf

Alias /sarg /var/www/html/reports/daily

<Directory /var/www/html/reports/daily>
DirectoryIndex index.html
Order deny,allow
Deny from all
# add IP address you allow
Allow from 192.168.0.2
</Directory>

Now create a script to create daily statistics.

[root@linuxbox ~]# vim sarglog.sh

#!/bin/bash

#Get current date
TODAY=$(date +%d/%m/%Y)

#Get one week ago today
YESTERDAY=$(date –date “1 day ago” +%d/%m/%Y)

/usr/local/bin/sarg -l /var/log/squid/access.log -o /var/www/html/reports/daily -z -d $YESTERDAY-$TODAY

exit 0

# run at 1:00 AM every day

[root@linuxbox ~]# crontab -e

00 01 * * * /root/sarglog.sh

# Now you can access your squid reports and it will show like below :-

http://192.168.0.1/sarg/

=====================================================================

Enjoy Linux !!!

Mega World News Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google Yahoo Buzz StumbleUpon Weekend Joy

Comments

  1. Linux Surgeon » Blog Archive » Howto install Squid Proxy Server on CentOS Said,

    [...] all you have done squid proxy server. Sarg – Squid Analysis Report Generator is a tool that allow you to view “where” your users are going to on the [...]

  2. Sarg has problem. Cannot see the logs !!!! Said,

    [...] netseer_task = "ad"; document.write('[Log in to get rid of this advertisement]'); Hello 4rum, http://www.linuxsurgeon.org/kb/howto…on-centos.html i have just install Sarg as link instruction follow, but i cannot see the logs on the website like [...]

  3. piyushmap Said,

    Hi,

    Can you update me your sarg.conf , squid.conf files and client side configuration.
    So i will assist you better. And also update me the output of
    /var/log/squid/access.log file.

    Thanks for visiting my site. http://www.linuxsurgeon.org/kb

  4. Howto SARG on Centos « The Linux Boy Said,

    [...] How to SARG on Centos | Fedora | RedHat [...]

  5. Kuldeep Said,

    Dear Piyush,
    I have configured Transparent squid Proxy Server on my firewall. Now I have installed SARG. But when I start apache its giving error as port in use(80). So I changed the port to 8080.
    Apache started well. But I can’t access SARG from web browser. So Please Guide me.

    Waiting for response.

    Thanks
    Kuldeep

  6. piyushmap Said,

    Hi,

    What error you are getting when you access SARG. And what is your “Directory” path of sarg.
    Can you update me you sarg.conf file and httpd.conf file, So i will check and assist you better.

    Thank you.
    Piyush

  7. Sarmed Said,

    Thanks man…I was trying YUM install with CentOS 6 and facing some problems. But tried this and it worked :)

    Thanks again.
    Sarmed

Add A Comment

*