适用于exim4 SMTP日志的Awstats maillogconvert

时间:2019-04-30 09:29:25

标签: email smtp exim awstats exim4

我正在通过exim4(通过外部SMTP)从Ubuntu服务器发送邮件,我希望能够使用awstats 7.6查看发送日志

我使用了本指南来设置我的awstats配置文件:https://wiki.gentoo.org/wiki/Complete_Virtual_Mail_Server/awstats

文件awstats.mailstat.mydomain.com.conf的配置如下:

LogFile="perl /usr/share/awstats/tools/maillogconvert.pl standard < /var/log/exim4/mainlog |"
LogType=M

#i'm not completely sure about the LogFormat line
LogFormat="%time2 %email %email_r %host %host_r %method %url %code %bytesd"

LogSeparator=" "
SiteDomain="mydomain.com"
HostAliases="localhost 127.0.0.1 REGEX[myserver\.com$]"
DNSLookup=2
DirData="/var/www/mydomain.com"
DirCgi="/cgi-bin"
DirIcons="/awstatsicons"
AllowToUpdateStatsFromBrowser=0
AllowFullYearView=2
EnableLockForUpdate=0
DNSStaticCacheFile="dnscache.txt"
DNSLastUpdateCacheFile="dnscachelastupdate.txt"
SkipDNSLookupFor=""
AllowAccessFromWebToAuthenticatedUsersOnly=0
AllowAccessFromWebToFollowingAuthenticatedUsers=""
AllowAccessFromWebToFollowingIPAddresses=""
CreateDirDataIfNotExists=0
BuildHistoryFormat=text
BuildReportFormat=html
SaveDatabaseFilesWithPermissionsForEveryone=1
PurgeLogFile=0
ArchiveLogRecords=0
KeepBackupOfHistoricFiles=0
DefaultFile="index.html"
SkipHosts=""
SkipUserAgents=""
SkipFiles=""
OnlyHosts=""
OnlyUserAgents=""
OnlyFiles=""
NotPageList="css js class gif jpg jpeg png bmp ico"
ValidHTTPCodes="200 304"
ValidSMTPCodes="1 250"
AuthenticatedUsersNotCaseSensitive=0
URLNotCaseSensitive=0
URLWithAnchor=0
URLQuerySeparators="?;"
URLWithQuery=0
URLWithQueryWithOnlyFollowingParameters=""
URLWithQueryWithoutFollowingParameters=""
URLReferrerWithQuery=0
WarningMessages=1
ErrorMessages=""
DebugMessages=1
NbOfLinesForCorruptedLog=50
WrapperScript=""
DecodeUA=0
MiscTrackerUrl="/js/awstats_misc_tracker.js"

LevelForBrowsersDetection=0
LevelForOSDetection=0
LevelForRefererAnalyze=0
LevelForRobotsDetection=0
LevelForSearchEnginesDetection=0
LevelForKeywordsDetection=0
LevelForFileTypesDetection=0
LevelForWormsDetection=0

UseFramesWhenCGI=1
DetailedReportsOnNewWindows=1
Expires=0
MaxRowsInHTMLOutput=1000

Lang="en"
DirLang="./lang"

ShowMenu=1
ShowMonthStats=UVPHB
ShowDaysOfMonthStats=VPHB
ShowDaysOfWeekStats=PHB
ShowHoursStats=PHB
ShowDomainsStats=PHB
ShowHostsStats=PHBL
ShowAuthenticatedUsers=0
ShowRobotsStats=0
ShowWormsStats=0
ShowEMailSenders=HBML
ShowEMailReceivers=HBML
ShowSessionsStats=0
ShowPagesStats=0
ShowFileTypesStats=0
ShowFileSizesStats=0
ShowOSStats=0
ShowBrowsersStats=0
ShowScreenSizeStats=0
ShowOriginStats=0
ShowKeyphrasesStats=0
ShowKeywordsStats=0
ShowMiscStats=0
ShowHTTPErrorsStats=0
ShowSMTPErrorsStats=1
ShowClusterStats=0

AddDataArrayMonthStats=1
AddDataArrayShowDaysOfMonthStats=1
AddDataArrayShowDaysOfWeekStats=1
AddDataArrayShowHoursStats=1
IncludeInternalLinksInOriginSection=0
MaxNbOfDomain = 10
MinHitDomain  = 1
MaxNbOfHostsShown = 10
MinHitHost    = 1
MaxNbOfLoginShown = 10
MinHitLogin   = 1
MaxNbOfRobotShown = 10
MinHitRobot   = 1
MaxNbOfPageShown = 10
MinHitFile    = 1
MaxNbOfOsShown = 10
MinHitOs      = 1
MaxNbOfBrowsersShown = 10
MinHitBrowser = 1
MaxNbOfScreenSizesShown = 5
MinHitScreenSize = 1
MaxNbOfRefererShown = 10
MinHitRefer   = 1
MaxNbOfKeyphrasesShown = 10
MinHitKeyphrase = 1
MaxNbOfKeywordsShown = 10
MinHitKeyword = 1
MaxNbOfEMailsShown = 20
MinHitEMail   = 1

尝试更新awstats配置

/# sudo /usr/lib/cgi-bin/awstats.pl -update -config=mailstat.mydomain.com
Create/Update database for config "/etc/awstats/awstats.mailstat.mydomain.com.conf" by AWStats version 7.6 (build 20161204)
From data in log file "/var/log/exim4/mainlog"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
AWStats did not find any valid log lines that match your LogFormat parameter, in the 50th first non commented lines read of your log.
Your log file /var/log/exim4/mainlog must have a bad format or LogFormat parameter setup does not match this format.
Your AWStats LogFormat parameter is:
%time2 %email %email_r %host %host_r %method %url %code %bytesd
This means each line in your web server log file need to have the following personalized log format:
%time2 %email %email_r %host %host_r %method %url %code %bytesd
And this is an example of records AWStats found in your log file (the record number 50 in your log):
2019-04-30 06:25:26 1hKwzS-0002qZ-GR Message is frozen
Setup ('/etc/awstats/awstats.mailstat.mydomain.com.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).

我需要如何配置LogFormat行才能成功解析exim4日志文件?

0 个答案:

没有答案