笔记 by 车东

用AWStats统计Mail服务日志(sendmail)并生成报表

· 日志分析|AWStats

AWStats也可以用来对FTP和Mail的日志进行统计,一下是一个针对Postfix邮件发送日志的配置样例:

日志类型设置为邮件:M格式

LogType=M

日志字段要一一指定;

LogFormat="%time2 %email %email_r %host %host_r %method %url %code %bytesd" LevelForBrowsersDetection=0 LevelForOSDetection=0 LevelForRefererAnalyze=0 LevelForRobotsDetection=0 LevelForWormsDetection=0 LevelForSearchEnginesDetection=0 LevelForFileTypesDetection=0 ShowMenu=1 ShowMonthStats=HB ShowDaysOfMonthStats=HB ShowDaysOfWeekStats=HB ShowHoursStats=HB ShowDomainsStats=0 ShowHostsStats=HBL ShowAuthenticatedUsers=0 ShowRobotsStats=0 ShowEMailSenders=HBL ShowEMailReceivers=HBL ShowSessionsStats=0 ShowPagesStats=0 ShowFileTypesStats=0 ShowFileSizesStats=0 ShowBrowsersStats=0 ShowOSStats=0 ShowOriginStats=0 ShowKeyphrasesStats=0 ShowKeywordsStats=0 ShowMiscStats=0 ShowHTTPErrorsStats=0 ShowSMTPErrorsStats=1

对于mail原始日志用maillogconvert.pl进行转换,脚本位于awstats/tools目录下;

LogFile="/bin/zcat /var/mail/mail.1.log.gz |/usr/bin/perl /path/to/maillogconvert.pl standard | "

AWStats统计输出样例: http://www.chedong.com/cgi-bin/awstats/awstats.pl?config=mail

参考文档: 使用 Awstats 分析 maillog (適用sendmail、Postfix… 等) by Neo