logwatchの出力先をメールではなくファイルにする
Logwatchをインストールすると/etc/cron.dailyにCronファイルができますが、デフォルトで通知先はメールになります。こちらファイル出力に変更することが可能です。
以下を編集
/etc/cron.daily/0logwatch
#!/bin/sh #Set logwatch location LOGWATCH_SCRIPT="/usr/sbin/logwatch" #Add options to this line. Most options should be defined in /etc/logwatch/conf/logwatch.conf, #but some are only for the nightly cronrun such as --output mail and should be set here. #Other options to consider might be "--format html" or "--encode base64", man logwatch for more details. OPTIONS="--output mail" #Call logwatch $LOGWATCH_SCRIPT $OPTIONS exit 0
↓ファイル出力に変更(YYYYMMDD付き)
#!/bin/sh #Set logwatch location LOGWATCH_SCRIPT="/usr/sbin/logwatch" #Add options to this line. Most options should be defined in /etc/logwatch/conf/logwatch.conf, #but some are only for the nightly cronrun such as --output mail and should be set here. #Other options to consider might be "--format html" or "--encode base64", man logwatch for more details. #OPTIONS="--output mail" OPTIONS="--output file --filename /home/hoge/logwatch_log/logwatch_`date '+%Y%m%d'`.log" #Call logwatch $LOGWATCH_SCRIPT $OPTIONS exit 0
手動実行の場合(YYYYMMDD付き)
logwatch --output file --filename /home/hoge/logwatch_log/logwatch_`date '+%Y%m%d'`.log