2017年7月11日火曜日

logwatch 設定 logwatch.conf

logwatch送信時に自分で設定したコマンドの結果や自分のスクリプト結果も送れないかと思って調べてみた。

結果:できそうだけど、面倒そうなのでやめた。

logwatchはログ収集専門だろうけど、

hdd空容量表示に
df
を使っているのだろうから他のコマンドも使えるだろう。

参考にしようと思ってdfを扱っている部分を見てみると
/usr/share/logwatch/scripts/services/zz-disk_space.conf
(話は違うがオーバーライドさせたいなら、
/etc/logwatch/conf/services/zz-disk_space.conf
ここに書き込んどいたほうが安全。)
1行で簡単にすむと思ったらそうでもない。
違う方法の方がよさげ。
ログに結果を出してそれを読ませるとか・・・。

ちなみに
/usr/share/logwatch/scripts/services/
に並んでいるサービスのオン・オフ切り替えは、logwatch.confのServiceで設定できる。
---CentOS6のconf----------------------------------------
Service = All
# You can also disable certain services (when specifying all)
Service = "-zz-network"     # Prevents execution of zz-network service, which
                            # prints useful network configuration info.
Service = "-zz-sys"         # Prevents execution of zz-sys service, which
                            # prints useful system configuration info.
Service = "-eximstats"      # Prevents execution of eximstats service, which
                            # is a wrapper for the eximstats program.
-------------------------------------------
Allで全部をオンにしておいて、不必要なものに"-"をつけている。


logwatchの設定ファイル置き場。
優先順位は一番下が一番優先される。
/usr/share/logwatch/default.conf/logwatch.conf
/usr/share/logwatch/dist.conf/logwatch.conf
/etc/logwatch/conf/logwatch.conf
/etc/logwatch/conf/override.conf


実行するにはそのまま
logwatch



logwatch本体
/usr/share/logwatch/scripts/logwatch.pl

0 件のコメント:

コメントを投稿