LoginSignup
8
7

More than 5 years have passed since last update.

swatchでログ監視、メール送信

Last updated at Posted at 2015-09-10

参考

設定

~/.swatchrc
watchfor /START|END/
  echo
  mail addresses=to\@myserver.com,subject=start_end_log
watchfor /.*/
  echo
  • ログファイルに START もしくは END が含まれる行を発見したらto@myserver.comにメール送信します。
  • @ は エスケープする必要があるようです。

実行方法

root権限が必要な場合
sudo swatch -c ~/.swatchrc -t /var/log/secure
設定ファイルの場所を指定する場合
swatch -c /srv/app/swatchrc -t /srv/app/log/production.log
  • --daemon で常駐。
8
7
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
8
7