下記のように設定ファイルを配置。
/etc └─logwatch ├─conf │ │ ignore.conf │ │ logwatch.conf │ │ override.conf │ ├─services ★ │ │ domain1.conf │ │ domain2.conf │ │ : │ └─logfiles ★★│ domain1.conf │ domain2.conf │ : └─scripts ├─shared ├─services ★★★ │ domain1 -> /usr/share/logwatch/scripts/services/http │ domain2 -> /usr/share/logwatch/scripts/services/http │ : └─logfilesそれぞれのファイル内容は▼
● ★ は、ログファイルの位置するパスを指定。デフォルト設定からコピーして編集。
[root@www ~]# cp /usr/share/logwatch/default.conf/logfiles/http.conf /etc/logwatch/conf/logfiles/domain1.conf [root@www ~]# vi /etc/logwatch/conf/logfiles/domain1.conf [root@www ~]# diff /usr/share/logwatch/default.conf/logfiles/http.conf /etc/logwatch/conf/logfiles/domain1.conf 6,12c6,14 < LogFile = httpd/*access_log < LogFile = apache/*access.log.1 < LogFile = apache/*access.log < LogFile = apache2/*access.log.1 < LogFile = apache2/*access.log < LogFile = apache-ssl/*access.log.1 < LogFile = apache-ssl/*access.log --- > #LogFile = httpd/*access_log > #LogFile = apache/*access.log.1 > #LogFile = apache/*access.log > #LogFile = apache2/*access.log.1 > #LogFile = apache2/*access.log > #LogFile = apache-ssl/*access.log.1 > #LogFile = apache-ssl/*access.log > LogFile = /home/taro/web/www/logs/access_log > LogFile = /home/taro/web/www/logs/access_log.1 18,22c20,25 < Archive = archiv/httpd/*access_log.* < Archive = httpd/*access_log.* < Archive = apache/*access.log.*.gz < Archive = apache2/*access.log.*.gz < Archive = apache-ssl/*access.log.*.gz --- > #Archive = archiv/httpd/*access_log.* > #Archive = httpd/*access_log.* > #Archive = apache/*access.log.*.gz > #Archive = apache2/*access.log.*.gz > #Archive = apache-ssl/*access.log.*.gz > Archive = /home/taro/web/domain1/logs/*access_log.*● ★★ も、デフォルト設定からコピーして編集。注意:LogFile 値は、★・★★・★★★ の拡張子を除くファイル名と等しい。ドットや大文字は使えない。
[root@www ~]# cp /usr/share/logwatch/default.conf/services/http.conf /etc/logwatch/conf/services/domain1.conf [root@www ~]# vi /etc/logwatch/conf/services/domain1.conf [root@www ~]# diff /usr/share/logwatch/default.conf/services/http.conf /etc/logwatch/conf/services/domain1.conf 5c5 < Title = "httpd" --- > Title = "httpd:MyDomainA" 8c8 < LogFile = http --- > LogFile = domain1● ★★★ は、仮想サーバ毎に 既存の http 用スクリプトへのシンボリックリンク。
[root@www ~]# cd /etc/logwatch/scripts/services [root@www services]# ln -s /usr/share/logwatch/scripts/services/http domain1●試験
[root@www ~]# logwatch -service domain1 --range All --print --debug Med