Thursday 31 July 2014

Squid Analyzer - Squid Report Analyzer

 





Squid Proxy native log analyzer and reports generator with full statistics about times, hits, bytes, users, networks, top urls and top domains. Statistic reports are oriented toward user and bandwidth control; this is not a pure cache statistics generator.
SquidAnalyzer use flat files to store data and don't need any SQL, SQL Lite or Berkeley databases.

This log analyzer is incremental and should be run in a daily cron or more often on huge network traffic. 


Squid Analyzer in CentOS 6.4

----------------------------------------------------------------------------------------
1) Stop unwanted Services or settings
----------------------------------------------------------------------------------------
# /etc/init.d/NetworkManager stop
# chkconfig NetworkManager off
Note: Make sure you have configured Network i.e. (IP Address/Netmask/Gateway/DNS)

# vi /etc/sysconfig/selinux
SELINUX=disabled



----------------------------------------------------------------------------------------
2) Open Necessary Ports in iptables
----------------------------------------------------------------------------------------
[root@server ~]#vi /etc/sysconfig/iptables
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT


----------------------------------------------------------------------------------------
3) Install Require Packages and dependencies and verify
----------------------------------------------------------------------------------------

[root@server ~]#yum install perl-ExtUtils-MakeMaker perl-GD-Graph perl-GD-Graph3d make gd libpng
[root@server ~]#yum install perl-Time-HiRes



----------------------------------------------------------------------------------------
4) Download Squidanalyzer Packages Compile
----------------------------------------------------------------------------------------
[root@server ~]#cd /var/www/
[root@server ~]#wget http://downloads.sourceforge.net/project/squid-report/squid-report/5.4/squidanalyzer-5.4.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fsquid-report%2F&ts=1406810704&use_mirror=cznic
[root@server ~]#tar -zxvf squidanalyzer-5.4.tar.gz
[root@server ~]#cd squidanalyzer-5.4
[root@server ~]#perl Makefile.PL
[root@server ~]#make
[root@server ~]#cp SquidAnalyzer.pm blib/lib/SquidAnalyzer.pm
[root@server ~]#make install





----------------------------------------------------------------------------------------
5) Install and Configure Apache Web Server
----------------------------------------------------------------------------------------
[root@server ~]#yum install httpd

[root@server ~]#vi /etc/httpd/conf/httpd.conf



### SquidAnalyzer ###
Alias /squidreport /var/www/squidanalyzer
<Directory /var/www/squidanalyzer>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order deny,allow
Deny from all
Allow from all
</Directory>




[root@server ~]#/etc/init.d/httpd restart


----------------------------------------------------------------------------------------
6) Create squidanalyzer-update script Set Cron for squidanalyzer
----------------------------------------------------------------------------------------

[root@server ~]#vi /etc/cron.daily/squidanalyzer-update.sh

#!/bin/sh
/usr/local/bin/squid-analyzer --logfile /opt/squid/var/logs/access.log --configfile /etc/squidanalyzer/squidanalyzer.conf

[root@server ~]#chmod +x /etc/cron.daily/squidanalyzer-update.sh




----------------------------------------------------------------------------------------
7) Edit squidanalyzer Main Config File & Do Following Changes
----------------------------------------------------------------------------------------

[root@server ~]#vi /var/www/squidanalyzer/etc/squidanalyzer.conf

# Set the path to the Squid log file
LogFile /opt/squid/var/logs/access.log



----------------------------------------------------------------------------------------
8) Edit squidanalyzer network-aliases Config File & Do Following Changes
----------------------------------------------------------------------------------------

[root@server ~]#vi /var/www/squidanalyzer/etc/network-aliases
ClassC Network          192.168.1.0/24

ClassC Network          192.168.2.0/24

Access via Browser

http:SERVER-IP or http://Server-IP-squidreport




#################################################################################################


Secure Your Directory Access with htpasswd


----------------------------------------------------------------------------------------
1: Edit httpd.conf & Insert Following Container
----------------------------------------------------------------------------------------

[root@server ~]#vi /etc/httpd/conf/httpd.conf

### SquidAnalyzer ###
Alias /squidreport /var/www/squidanalyzer
<Directory /var/www/squidanalyzer>
############### HTTP AUTHENTICATION START ############
AuthType Basic
AuthName "Restricted Access"
AuthUserFile /opt/squidanalyzer.passwords
Require valid-user
############### HTTP AUTHENTICATION END ############

Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order deny,allow
Deny from all
Allow from all
</Directory>


----------------------------------------------------------------------------------------
2: Then Generate a Username & Password with Following Command.
----------------------------------------------------------------------------------------

[root@server ~]#htpasswd -c /opt/squidanalyzer.passwords devendra


----------------------------------------------------------------------------------------
3: Check if password & username is generated
----------------------------------------------------------------------------------------

[root@server ~]#cat /opt/squidanalyzer.passwords
devendra:FgjXxAAssuZIo






Access via Browser

http:SERVER-IP or http://Server-IP-squidreport




Ref Link :http://squidanalyzer.darold.net/index.html










5 comments:

  1. dear sir i am getting "Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 1.
    BEGIN failed--compilation aborted at Makefile.PL line 1." this error while typing perl Makefile.PL . what should I do ??

    ReplyDelete
  2. install perl module properly.

    ReplyDelete
  3. SquidAnalyzer6.5 not able to generate log since May and April 2016. What is the cause?

    ReplyDelete
  4. Hi.
    I do all the config and give me this error "You don't have permission to access /squidreport/ on this server".. im using Centos 7...... can you give me a hand?? Thanks

    ReplyDelete
  5. Just found out about this analyzer, but when I enter the page, there are only folders and files. Is there an extra configuracion I have to make on apache?

    ReplyDelete