18 avril 2012
[Awstats] Installation et configuration pour postfix
Installation de awstats sous Squeeze :
apt-get install awstats
Configuration de awstats pour postfix :
cp /etc/awstats/awstats.conf /etc/awstats/awstats.postfix.conf cp /usr/share/doc/awstats/examples/maillogconvert.pl /usr/share/awstats
Ensuite il faut éditer le fichier de conf « /etc/awstats/awstats.postfix.conf » afin de personnaliser l’interface pour coller au mieux à postfix :
LogFile="/usr/share/awstats/maillogconvert.pl standard < /var/log/mail.log |" LogType=M LogFormat="%time2 %email %email_r %host %host_r %method %url %code %bytesd" SiteDomain="mysteryland.emc.fr" DirIcons="./icon" LevelForBrowsersDetection=0 LevelForOSDetection=0 LevelForRefererAnalyze=0 LevelForRobotsDetection=0 LevelForSearchEnginesDetection=0 LevelForKeywordsDetection=0 LevelForFileTypesDetection=0 LevelForWormsDetection=0 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
Création de la page web :
mkdir /var/www/awstats ln -s /usr/share/awstats/icon /var/www/awstats/icon
Génération des données :
/usr/lib/cgi-bin/awstats.pl -config=postfix -update
Génération des reports HTML :
/usr/lib/cgi-bin/awstats.pl -config=postfix -output -staticlink > /var/www/awstats/index.html
L’interface se trouve à l’adresse http://@IP/awstats
Pour une mise à jour automatique de l’interface il suffit de renseigner la crontab (crontab -e) :
*/5 * * * * /usr/lib/cgi-bin/awstats.pl -config=postfix -update */5 * * * * /usr/lib/cgi-bin/awstats.pl -config=postfix -output -staticlink > /var/www/awstats/index.html
Les rapports seront maintenant générés toutes les cinq minutes (à partir du fichier de log « mail.log »).
Il est bien évidement possible de modifier le fichier de configuration au niveau des UHBML afin de personnaliser différement l’interface.
About Author
Johan
2 Comments
Très bon tutoriel.
LogFormat -> %time2 compatible avec « Oct 19 13:51:08 »?
# %time2 Date and time with format: yyyy-mm-dd hh:mm:ss
Ok, /usr/share/doc/awstats/examples/maillogconvert.pl les passe à la moulinette.