nginxのログをlogwatchでみたいということでしらべた。Logwatch 7.9では対応している。kusanagiでは、ログの場所が別なので、設定をみる。ちょっとは、ファイルを操作する必要があった。
# アクセスログ監視設定
cp /usr/share/logwatch/scripts/services/http /etc/logwatch/scripts/services/nginx
cp /usr/share/logwatch/default.conf/services/http.conf /etc/logwatch/conf/services/nginx.conf
cp /usr/share/logwatch/default.conf/logfiles/http.conf /etc/logwatch/conf/logfiles/nginx.conf
# エラーログ監視設定
cp /usr/share/logwatch/scripts/services/http-error /etc/logwatch/scripts/services/nginx-error
cp /usr/share/logwatch/default.conf/services/http-error.conf /etc/logwatch/conf/services/nginx-error.conf
cp /usr/share/logwatch/default.conf/logfiles/http-error.conf /etc/logwatch/conf/logfiles/nginx-error.conf
vi /etc/logwatch/conf/services/nginx.conf
-
Title = "nginx"
LogFile = nginx
-
:wq
vi /etc/logwatch/conf/services/nginx-error.conf
-
Title = "nginx Errors"
LogFile = nginx-error
-
:wq
vi /etc/logwatch/conf/logfiles/nginx.conf
LogFile = /home/kusanagi/xxx/log/nginx/*access.log
LogFile = /home/kusanagi/xxx/log/nginx/*ssl_access.log
Archive = /home/kusanagi/xxx/log/nginx/*access.log-*.gz
Archive = /home/kusanagi/xxx/log/nginx/*ssl_access.log-*.gz
# Keep only the lines in the proper date range...
#*ApplyhttpDate
vi /etc/logwatch/conf/logfiles/nginx-error.conf
LogFile = /home/kusanagi/xxx/log/nginx/*error.log
LogFile = /home/kusanagi/xxx/log/nginx/*ssl_error.log
Archive = /home/kusanagi/xxx/log/nginx/*error.log-*.gz
Archive = /home/kusanagi/xxx/log/nginx/*ssl_error.log-*.gz
*ApplyhttpDate をはずしてうまくいった
まえは、仮想ドメインで、複数サイトのログが一括で送られてきたので、エラーの発生ドメインがわからなかった。今回、ドメインごとに分けて検査さえようとおもった。
/etc/logwatch/conf/services/nginx.conf を
/etc/logwatch/conf/services/nginx_site_domein_com.conf
にして
LogFile = nginx_site_domein_com
にして
/etc/logwatch/conf/logfiles/nginx_site_domein_com.conf
をつくり、ログを記述する。
最初 logfilesのconfのファイル名を
nginx.site.domein.com.conf にしてたら認識しなくて、エラーになった。_に変更してうまくいった。
山形市は雪。1.1℃。
2024年1月25日(木曜日)
関連キーワード
関連記事
令和6年1月25日
- 平成36年1月25日
- 昭和99年1月25日
- 旧12月15日
- 睦月
今日は何の日
- 日本最低気温の日
- お詫びの日
- 中華まんの日・あったか旭川まんの日
- 左遷の日
- 石ノ森章太郎生誕記念日
- 菅公学生服の日
- 美容記念日
- ホットケーキの日
- 一室入魂の日
- とちぎのいちごの日
- 主婦休みの日
- プリンの日
- 法然忌
- 天神の縁日
- 全国学校給食週間
- こちらから引用
コメント