qmailanalog¤Ç¤Ç¤­¤ë¤³¤È

  • zdeferrals¡§deferrals¡ÊÇÛÁ÷¤¬Àè±ä¤Ð¤·¡Ë¤µ¤ì¤¿¤È¤­¤ÎÍýͳ¤Î½¸·×
  • zddist¡§¥á¡¼¥ëÃÙÁ÷¤Î½¸·×
  • zfailures¡§¼ºÇԥ᡼¥ë¤Î³Îǧ
  • zoverall¡§´ðËÜŪ¤ÇºÇ¤â½ÅÍפÊÅý·×
  • zrecipients¡§¼õ¤±¼è¤êÀè¤ÎÅý·×
  • zrhosts¡§Áê¼ê¤Î¥Û¥¹¥È¤Î½¸·×
  • zrxdelay¡§¼õ¤±¼è¤êÀè¤ÎÅý·×¡ÊÃÙ¤ì¶ñ¹ç¤Ç¥½¡¼¥È¡Ë
  • zsenders¡§º¹¤·½Ð¤·¸µ¤Î½¸·×
  • zsuccesses¡§À®¸ù»þ¤ÎÍýͳ¤Î½¸·×
  • zsuids¡§º¹¤·½Ð¤·¸µ¤ÎUID½¸·×

qmailanalog¤Ë¤Ïmultilog¤«¤éÆÃÄê¤Î´ü´Ö¤ò¼è¤ê½Ð¤·¤Æ²òÀϤ¹¤ëµ¡Ç½¤Ï¤Ä¤¤¤Æ¤Ê¤¤¤Î¤ÇÊÌÅӰʲ¼¤Î¤è¤¦¤Ê¼ê½ç¤òƧ¤àɬÍפ¬¤¢¤ë

  1. /var/log/qmail/¥Ç¥£¥ì¥¯¥È¥ê²¼¤Î¥í¥°¥Õ¥¡¥¤¥ë¤«¤éqlogselect¥³¥Þ¥ó¥É¤Ç»ØÄê¤Î¥í¥°¤òÃê½Ð¤¹¤ë
  2. Ãê½Ð¤·¤¿¥í¥°¤òmatchup¤ÇÀ°·Á¤·¡¢°ì»þ¥Õ¥¡¥¤¥ë¤ËÊݸ
  3. °ì»þÊݸ¤·¤¿¥Õ¥¡¥¤¥ë¤ò³Æ¥¹¥¯¥ê¥×¥È¤ÇɬÍפʾðÊó¤ò¼ý½¸¤¹¤ë
  4. ¥á¡¼¥ë¤Ç´ÉÍý¼Ô¤ËÊó¹ð

qmailanalog¥¤¥ó¥¹¥È¡¼¥ë

http://cr.yp.to/qmailanalog.html ¤«¤é qmailanalog-0.70.tar.gz ¤ò¥²¥Ã¥È

# tar xvfz qmailanalog-0.70.tar.gz
# cd qmailanalog-0.70
# make
# make setup check 

/usr/local/qmailanalog ¤Ë¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤ë

qlogselect¤Î½àÈ÷

# wget http://www.qcc.sk.ca/~charlesc/software/misc/qlogselect
# chmod +x qlogselect
# mv qlogselect /usr/local/qmailanalog/bin 

¼Â¹Ô¥¹¥¯¥ê¥×¥È¤ÎºîÀ®

tai64n2tai ¥³¥Þ¥ó¥É¤¬¤Ê¤¤¤Î¤Ç http://untroubled.org/qlogtools/ ¤«¤é qlogtools-3.1.tar.gz ¤ò¥²¥Ã¥È¤¹¤ë

# tar xvzf qlogtools-3.1.tar.gz
# cd qlogtools-3.1
# make
# mv tai64n2tai /usr/local/qmailanalog/bin
# cd ..
# rm -fr qlogtools-3.1*
# vi /usr/local/qmailanalog/bin/analog.sh
#!/bin/sh
MAILTO=mailto@example.com
MAILFROM=mailfrom@example.com
export PATH="$PATH:/usr/local/qmailanalog/bin:/var/qmail/bin"
tmpdir=/tmp/qmail-cron.$$.$RANDOM

mkdir $tmpdir
pushd $tmpdir >/dev/null

s_year=`date -d '1 day ago' +%Y`
s_month=`date -d '1 day ago' +%m`
s_day=`date -d '1 day ago' +%d`
e_year=`date +%Y`
e_month=`date +%m`
e_day=`date +%d`

start="$s_year-$s_month-$s_day"
end="$e_year-$e_month-$e_day"

LOGDIR=/var/log/qmail

cat "$LOGDIR"/{"@",cur}* \
| tai64n2tai \
| qlogselect start $start end $end \
| matchup >logfile 5>/dev/null

for ana in zoverall zddist zdeferrals zfailures zrhosts zsuids zrxdelay; do
echo "" >>result
echo "-----------Result of $ana------------" >>result
$ana 2>/dev/null <logfile >>result
done
rm -f logfile

(echo "To: $MAILTO"
echo "From: $MAILFROM"
echo "Subject: mailstats for $s_year-$s_month-$s_day"
echo ""
cat result )| qmail-inject -f $MAILFROM
rm -f result
popd >/dev/null
rm -rf $tmpdir

2Æü´Ö¤òÂоݤˤ¹¤ë¤Ê¤é¡Ö2 days ago¡×¡¢1½µ´Ö¤Ê¤é¡Ö1 week ago¡×

# chmod +x /usr/local/qmailanalog/bin/analog.sh
# /usr/local/qmailanalog/bin/analog.sh

¤Ç¥á¡¼¥ë¤¬ MAILTO °¸¤ËÆϤ±¤ÐOK

crontab¤Ç¼Â¹Ô¤¹¤ë¤Ë¤Ï

# crontab -e
30 4 * * * /usr/local/qmailanalog/bin/analog.sh 2>/dev/null

¥È¥Ã¥×   ÊÔ½¸ Åà·ë º¹Ê¬ ¥Ð¥Ã¥¯¥¢¥Ã¥× źÉÕ Ê£À½ ̾Á°Êѹ¹ ¥ê¥í¡¼¥É   ¿·µ¬ °ìÍ÷ ¸¡º÷ ºÇ½ª¹¹¿·   ¥Ø¥ë¥×   ºÇ½ª¹¹¿·¤ÎRSS
Last-modified: 2021-09-19 (Æü) 19:09:33