SMA (Sendmail log analyser) を試してみる

| | トラックバック(0)

たまには技術ネタを ( ^ω^)おっ おっ おっ

Sendmail のログを解析してくれるフリーソフトです。
http://www.klake.org/sma/

開発やめちゃったみたいですけど(´・ω・`)

mailstats(1) コマンドというものもあるのだけど、合計値だけしか出ないとかちょっと情報が少ないのでもう少し情報が欲しかったので試してみました。

今回は、Solaris9(sparc)の環境でインスコしました。
BGMはYUKIの「長い夢」です。(でもそんなの関係ねぇ!)
あと、バージョン1.3.2 で試してしまったけど、1.4 も使えるようなのでそっちのほうがいいかも。

インストールで参考にさせていただいたのはこちらのページです。

いろいろ長くなったので続きは追記に移動。

% gtar zxvf sma-1.3.2.tar.gz
% cd sma-1.3.2.tar.gz
% cp -p conf.h conf.h.org
% vi conf.h
% diff conf.h.org conf.h
13c13
< #define DEFAULT_CONF "./sma.conf"
---
> #define DEFAULT_CONF "/usr/local/etc/sma.conf"

% gmake
% su
# gmake -n install
./install-sh sma /usr/local/bin
./install-sh sma.8 /usr/local/man/man8
(一応ね(笑))

# gmake install
./install-sh sma /usr/local/bin
./install-sh sma.8 /usr/local/man/man8

# cp sma.conf /usr/local/etc/
# cd /usr/local/etc/
# cp -p sma.conf sma.conf.org
# vi sma.conf
# diff sma.conf.org sma.conf
27c27
< #HostName myhost.com
---
> HostName example.example.com(適宜)
33c33
< #OutFile /home/jt/report.html
---
> OutFile /usr/local/etc/sma_report.html

# /usr/local/bin/sma /var/log/syslog
#(解析終了)

デフォルトで読み込むファイルは /var/log/maillog のようなのでその場合は /varlog/syslog 部分は省略可です。
特に指定したい場合のみ。

参考までに help

# /usr/local/bin/sma -h

SMA version 1.3.2

usage: /usr/local/bin/sma [OPTIONS] [files...]
OPTIONS are
-a set the output format as ascii
-b background color (RGB) of the HTML form
-c show copyright information and exit
-C set report header as
-D analyse only log entries between dates d1 and d2
-d print only the domain portion of email addresses
-f use configuration from instead of default
-F do not use default configuration file even if it exists
-h print this text and exit
-H override the hostname with
-i print ASCII report as HTML comment (requires -w or -O html)
-L process only lines with syslog tag
-n do not print the time distribution
-o write output to
-O set output format (ascii/html/clog)
-p print current configuration to stdout
-s sort by tranfers
-q be quiet (no error messages)
-v show debugging information
-l print top addresses
-r print top relay addresses
-t set the internal hash table size (normal/big/huge/a,r)
-w set the output format as html
files log files

これで /usr/local/etc/sma_report.html に html が生成されます。
自動化する場合は、ここを他の場所にしたり、cron とかに登録するとよいでしょう。

(`□´) 以上である!(爆)

解析結果には、

* General information
* Top envelope pairs
* Top envelope senders
* Top envelope recipients
* Top relay pairs
* Top relay addresses, sender
* Top relay addresses, recipient
* Top status messages
* Top ruleset rejections
* Message distribution
  Inbound messages per day
 Outbound messages per day
 Inbound messages per hour
 Outbound messages per hour

といった項目が表示されます。
スパムとかエラーメールしか飛んでこないようなサーバで試してしまったのであまり結果がおもしろくなかった。
とりあえずうまくいったので、他OSのメールサーバにでも仕掛けてみます。

追記:
FreeBSD で ports があったのでインスコして動かしてみました。
まともなメールサーバだとログが多いので、結構処理に時間がかかるのと処理中CPUほぼ食い尽くしたり・・・
こりゃ別サーバに動かして解析したほうが賢いかもしれませぬ。
#CPUショボいサーバではやりたくない・・・(笑)

トラックバック(0)

このブログ記事を参照しているブログ一覧: SMA (Sendmail log analyser) を試してみる

このブログ記事に対するトラックバックURL: http://suken.jp/~kazu/mt/mt-tb.cgi/450

このブログ記事について

このページは、kazuが2007年7月26日 16:25に書いたブログ記事です。

ひとつ前のブログ記事は「7/24 静岡出張」です。

次のブログ記事は「Solaris audit(監査)の初歩」です。

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。