Monday, January 9, 2012

How to SARG on Centos | Fedora | RedHat

http://sourceforge.net/projects/sarg/files/sarg/sarg-2.3.1/sarg-2.3.1.tar.gz/download
# tar -zxvf sarg-2.3.1.tar.gz
# cd sarg-2.3.1/
# ./configure
# make 

# make install
=========================================================
Main sarg configuration file: /usr/local/etc/sarg.conf


# 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/

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


# vi /etc/httpd/conf.d/sarg.conf
Alias /sarg /var/www/html/reports/daily

DirectoryIndex index.html

===========================================================
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

============================================================
# crontab -e
00 01 * * * /root/sarglog.sh
============================================================

4 comments:

  1. Hi thanks for your post, can you put somewhat more in details, like how to access (use) this one...

    Regards,
    Sandeep CC

    ReplyDelete
    Replies
    1. just type on web browser http://your ip/sarg

      first you must start httpd service

      service httpd start

      Delete
    2. After following all above process,
      The webpage cannot be found

      Delete
  2. *** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version 0.18 but the autoconf macros are from gettext version 0.19

    ReplyDelete