Ubuntu 11.04
Sponsored Link

Mail Log Analyzer - AWstats
2011/05/04
  Install maillog analyzer AWstats. Web Server is also needed. Web Server is also necessarry to be installed.

[1] Install AWstats
root@mail:~#
aptitude -y install awstats


root@mail:~#
cp /etc/awstats/awstats.conf /etc/awstats/awstats.postfix.conf

root@mail:~#
cp /usr/share/doc/awstats/examples/maillogconvert.pl /usr/share/awstats

root@mail:~#
vi /etc/awstats/awstats.postfix.conf


# line 51: change

LogFile="
/usr/share/awstats/maillogconvert.pl standard < /var/log/mail.log |
"

# line 63: change

LogType=
M


# line 122: make it comment and add below

#
LogFormat=4
LogFormat="%time2 %email %email_r %host %host_r %method %url %code %bytesd"


# line 153: specify hostname

SiteDomain="
mail.srv.world
"

# line 222: change

DirIcons="
./icon
"

# line 831: change like below

LevelForBrowsersDetection=
0

LevelForOSDetection=
0

LevelForRefererAnalyze=
0

LevelForRobotsDetection=
0

LevelForSearchEnginesDetection=
0

LevelForKeywordsDetection=
0

LevelForFileTypesDetection=
0

LevelForWormsDetection=0

# line 949: change like follows

ShowMonthStats=
UHB

ShowDaysOfMonthStats=
HB

ShowDaysOfWeekStats=
HB

ShowHoursStats=
HB

ShowDomainsStats=
0

ShowHostsStats=
HBL

ShowRobotsStats=
0

ShowEMailSenders=
HBML

ShowEMailReceivers=
HBML

ShowSessionsStats=
0

ShowPagesStats=
0

ShowFileTypesStats=
0

ShowOSStats=
0

ShowBrowsersStats=
0

ShowOriginStats=
0

ShowKeyphrasesStats=
0

ShowKeywordsStats=
0

ShowMiscStats=
0

ShowHTTPErrorsStats=
0

ShowSMTPErrorsStats=
1


root@mail:~#
mkdir /var/www/awstats

root@mail:~#
ln -s /usr/share/awstats/icon /var/www/awstats/icon

root@mail:~#
vi /etc/apache2/sites-available/default


<Directory "/usr/lib/cgi-bin">

AllowOverride None

Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch

Order allow,deny

Allow from
10.0.0.0/24
# IP address you allow

</Directory>


# add follows

<Location /awstats>

Order Deny,Allow

Deny from all

Allow from 10.0.0.0/24
# IP address you allow

</Location>

</VirtualHost>

root@mail:~#
/etc/init.d/apache2 restart

* Restarting web server apache2
... waiting . ...done.

# generate reports

root@mail:~#
/usr/lib/cgi-bin/awstats.pl -config=postfix -update

Create/Update database for config "/etc/awstats/awstats.postfix.conf" by AWStats version 6.95 (build 1.943)
From data in log file "/usr/share/awstats/maillogconvert.pl standard < /var/log/mail.log |"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Warning: awstats has detected that some hosts names were already resolved in your logfile /usr/share/awstats/maillogconvert.pl standard < /var/log/mail.log |.
If DNS lookup was already made by the logger (web server), you should change your setup DNSLookup=1 into DNSLookup=0 to increase awstats speed.
Jumped lines in file: 0
Parsed lines in file: 19
Found 0 dropped records,
Found 0 corrupted records,
Found 0 old records,
Found 19 new qualified records.

# generate HTML from reports

root@mail:~#
/usr/lib/cgi-bin/awstats.pl -config=postfix -output -staticlink > /var/www/awstats/index.html

[2] Access to 'http://(your server's name or IP address)/awstats/' with web browser. Then following screen is shown and it's possible to make sure mail log summary.
 
Matched Content
 
Tweet