/etc/logrotate.d/ 中的两个文件试图管理同一个日志文件

Two files in /etc/logrotate.d/ trying to manage the same log file

如果 /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
}

在通常情况下,/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