0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

postfix のログの件

Posted at

pflogsumm がイマイチなこと

通常運用では全然困ってないのだが、エンドユーザに見せるにあたっては武骨すぎるし、.po 書いて jaなモノにする気もちょっとない。

pflogsumm を Webに出すスクリプト?

*** あるにはある *** が、古いくて、Linux 用 でGNUまみれなので使いにくい →自作したほうが良い? 

awstatsに何かしらある

awstats の存在は知っていたがWEBサーバのログはともかく、アクセスの状態を知るのもGoogle任せだったりして長らく放置していたが、maillog を食えるっていうので使ってみた。

awstats を実戦投入してみる。

  • FreeBSDなので、 /usr/local が base.
  • /var/log/maillog そのまま読むわけにも行かず・・・
#!/bin/sh

YEAR=$(date -v-1d "+%Y")
MONTH=$(date -v-1d "+%m")
DATE=$(date -v-1d  "+%d")

bzcat maillog.0.bz2 > /usr/local/www/awstats/logs/maillog
chown www /usr/local/www/awstats/logs/maillog
/usr/local/www/awstats/tools/awstats_buildstaticpages.pl -LL=ja -builddate=$YEAR-$MONTH-$DATE   -config=tmk -awstatsprog=/usr/local/www/awstats/cgi-bin/awstats.pl  -dir=/tmp/html -buildpdf=/usr/local/bin/htmldoc
rm /tmp/html/*.html
mv /tmp/html/*.pdf /var/log/mailsummary
/usr/local/script/mail/mailsend.php dummy awstats.tmk.$YEAR-$MONTH-$DATE.pdf admin@foobar.dom /var/log/mailsummary

とか、cronで呼べるスクリプトを予め仕込んでおきます。

  • /usr/local/etc/awstats.foobar.dom.conf
LogFile="/usr/local/www/awstats/tools/maillogconvert.pl standard </usr/local/www/awstats/logs/maillog |"
LogType=M
LogFormat="%time2 %email %email_r %host %host_r %method %url %code %bytesd"
LogSeparator=" "
SiteDomain="foobar.dom"
HostAliases="localhost 127.0.0.1 REGEX[myserver\.com$]"
DNSLookup=2
DynamicDNSLookup=0
DirData="."
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=0
PurgeLogFile=0
ArchiveLogRecords=0
KeepBackupOfHistoricFiles=0
DefaultFile="index.php index.html"
SkipHosts=""
SkipUserAgents=""
SkipFiles=""
SkipReferrersBlackList=""
OnlyHosts=""
OnlyUserAgents=""
OnlyUsers=""
OnlyFiles=""
NotPageList="css js class gif jpg jpeg png bmp ico rss xml swf eot woff woff2"
ValidHTTPCodes="200 304"
ValidSMTPCodes="1 250"
TrapInfosForHTTPErrorCodes = "400 403 404"
AuthenticatedUsersNotCaseSensitive=0
URLNotCaseSensitive=0
URLWithAnchor=0
URLQuerySeparators="?;"
URLWithQuery=0
URLWithQueryWithOnlyFollowingParameters=""
URLWithQueryWithoutFollowingParameters=""
URLReferrerWithQuery=0
WarningMessages=1
ErrorMessages=""
DebugMessages=0
NbOfLinesForCorruptedLog=50
WrapperScript=""
DecodeUA=0
MiscTrackerUrl="/js/awstats_misc_tracker.js"
UseFramesWhenCGI=1
DetailedReportsOnNewWindows=1
Expires=0
MaxRowsInHTMLOutput=10000
Lang="auto"
DirLang="./lang"
ShowMenu=1
ShowSummary=UVPHB
ShowMonthStats=UHB
ShowDaysOfMonthStats=HB
ShowDaysOfWeekStats=HB
ShowHoursStats=HB
ShowDomainsStats=0
ShowHostsStats=HBL
ShowAuthenticatedUsers=0
ShowRobotsStats=0
ShowWormsStats=0
ShowEMailSenders=HBML
ShowEMailReceivers=HBML
ShowSessionsStats=0
ShowPagesStats=0
ShowFileTypesStats=0
ShowFileSizesStats=0
ShowDownloadsStats=0
ShowOSStats=0
ShowBrowsersStats=0
ShowScreenSizeStats=0
ShowOriginStats=PH
ShowKeyphrasesStats=0
ShowKeywordsStats=0
ShowMiscStats=0
ShowHTTPErrorsStats=0
ShowHTTPErrorsPageDetail=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
MaxNbOfDownloadsShown = 10
MinHitDownloads = 1
MaxNbOfPageShown = 10
MinHitFile    = 1
MaxNbOfOsShown = 10
MinHitOs      = 1
MaxNbOfBrowsersShown = 10
MinHitBrowser = 1
MaxNbOfScreenSizesShown = 5
MinHitScreenSize = 1
MaxNbOfWindowSizesShown = 5
MinHitWindowSize = 1
MaxNbOfRefererShown = 10
MinHitRefer   = 1
MaxNbOfKeyphrasesShown = 10
MinHitKeyphrase = 1
MaxNbOfKeywordsShown = 10
MinHitKeyword = 1
MaxNbOfEMailsShown = 20
MinHitEMail   = 1
FirstDayOfWeek=1
ShowFlagLinks=""
ShowLinksOnUrl=1
UseHTTPSLinkForUrl=""
MaxLengthOfShownURL=64
HTMLHeadSection=""
HTMLEndSection=""
MetaRobot=0
Logo="awstats_logo6.png"
LogoLink="http://www.awstats.org"
BarWidth   = 260
BarHeight  = 90
StyleSheet=""
ExtraTrackedRowsLimit=500
  • 送られてきたPDFはこんな感じで・・・
  • report1.png
    report2.png

手を入れれば、もっときれいになると思います・・・  以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?