Newsyslog 通配符 - 輪換目錄中的所有日誌

Newsyslog 通配符 - 輪換目錄中的所有日誌

我正在運行 FreeBSD 8.1。我正在嘗試使 newsyslog 輪換由動態路徑定義的日誌:

# logfilename          [owner:group]    mode count size when  flags [/pid_file] [sig_num]
/path/logs/*.log    644  7     100  $D0   J
/path/logs/*/*.log  644  7     100  $D0   J

基本上我希望 newsyslog 輪換目錄 /path/logs/ 中以 .log 結尾的所有檔案。

我還想對 /path/logs/ 的所有子目錄執行相同的操作,這是我的設定檔的第二行。

但是當我這樣做時:

newsyslog -F

沒有日誌檔被輪換。

答案1

使用該G標誌/etc/newsyslog.conf有幫助:

# logfilename          [owner:group]    mode count size when  flags [/pid_file] [sig_num]
/path/logs/*.log    644  7     100  $D0   G
/path/logs/*/*.log  644  7     100  $D0   G

相關內容