2017-02-27 48 views
0

如果/etc/logrotate.d/中有兩個獨立的配置文件試圖以不同方式管理同一個日誌文件,會發生什麼情況?一個比另一個更受歡迎嗎?我需要刪除其中一個配置文件嗎?/etc/logrotate.d/中的兩個文件試圖管理相同的日誌文件

例如: 兩種配置 - /etc/logrotate.d/A和/etc/logrotate.d/B A的

內容:

/var/log/example.log { 
    rotate 4 
    weekly 
} 

B的內容:

/var/log/example.log { 
    rotate 3 
    weekly 
    compress 
} 
+1

投票結束此問題,作爲題外話題。請注意,Stackoverflow僅用於編程相關的問題。請查看[幫助/在線主題],瞭解可在此處詢問哪些主題。該幫助還對其他SE網站提出了適合此問題的建議。 – kaylum

回答

1

在通常情況下,/etc/logrotate.d中的文件全部由/etc/logrotate.conf文件中的include指令讀入。如果您在此設置中有多個指令與相同的文件相匹配,您將收到錯誤消息:

 
error: /etc/logrotate.conf:line_number duplicate log entry for logfile_path 
error: found error in logfile_path, skipping