search
LoginSignup
2

More than 5 years have passed since last update.

posted at

updated at

Organization

logwatch で実行されるスクリプトを1つづつ動作確認する

次のように幾つかの環境変数を指定しつつ、ログファイルをスクリプトにパイプでつなげていくと logwatch --range today --service kernel みたいにしたのと同じ出力が得られます。

export LANG=C PERL5LIB=/usr/share/logwatch/lib/ LOGWATCH_DEBUG=9 LOGWATCH_DATE_RANGE=today
cat /var/log/messages |
  perl /usr/share/logwatch/scripts/shared/applystddate |
  perl /usr/share/logwatch/scripts/shared/onlyservice kernel |
  perl /usr/share/logwatch/scripts/shared/removeheaders |
  perl /usr/share/logwatch/scripts/shared/expandrepeats |
  perl /usr/share/logwatch/scripts/services/kernel

なので、適当に切り貼りすれば特定のスクリプトだけの動きを確認できます。

export LANG=C PERL5LIB=/usr/share/logwatch/lib/ LOGWATCH_DEBUG=9 LOGWATCH_DATE_RANGE=today
cat /var/log/messages |
  perl /usr/share/logwatch/scripts/shared/applystddate |
  perl /usr/share/logwatch/scripts/shared/onlyservice kernel
  # 途中までの結果を表示

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
What you can do with signing up
2