iT邦幫忙

0

nginx logrotate 失敗問題

  • 分享至 

  • xImage

這是失敗的webview設定檔,是使用nginx rotatelog的設定檔改出來的
在/var/log/nginx資料夾階層裡面是有正常的每天切log
在底下資料夾webview卻沒有生效

設定檔:
/var/log/nginx/webview/*log {
create 0644 nginx nginx
daily
dateext
rotate 10
missingok

notifempty

nocompress
sharedscripts
postrotate
    /bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null || true
endscript

}

debug錯誤log
rotating pattern: /var/log/nginx/webview/*log after 1 days (10 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/nginx/webview/webview_access_log
log needs rotating
considering log /var/log/nginx/webview/webview_error_log
log needs rotating
rotating log /var/log/nginx/webview/webview_access_log, log->rotateCount is 10
dateext suffix '-20180208'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding old rotated logs failed
rotating log /var/log/nginx/webview/webview_error_log, log->rotateCount is 10
dateext suffix '-20180208'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding old rotated logs failed
renaming /var/log/nginx/webview/webview_access_log to /var/log/nginx/webview/web view_access_log-20180208
creating new /var/log/nginx/webview/webview_access_log mode = 0644 uid = 997 gid = 994
renaming /var/log/nginx/webview/webview_error_log to /var/log/nginx/webview/webv iew_error_log-20180208
creating new /var/log/nginx/webview/webview_error_log mode = 0644 uid = 997 gid = 994
running postrotate script
running script with arg /var/log/nginx/webview/*log : "
/bin/kill -USR1 cat /run/nginx.pid 2>/dev/null 2>/dev/null || true
"

hsiang11 iT邦好手 1 級 ‧ 2018-02-08 11:35:33 檢舉
我把webview這一層的log檔案清空測試,然後再把nginx重啟重建log
empty log files are rotated, old logs are removed
considering log /var/log/nginx/webview/webview_access_log
log does not need rotating (log has been already rotated)
系統還是直接認定新log已經被rotated過,不清楚運作的邏輯
hsiang11 iT邦好手 1 級 ‧ 2018-02-08 11:49:02 檢舉
然後我下logrotate -f -v /etc/logrotate.d/webview竟然成功分割了
下logrotate webview 卻顯示log does not need rotating (log has been already rotated)
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答