krisharmas
krisharmas

Reputation: 211

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

If there are two separate config files in /etc/logrotate.d/ that are trying to manage the same log file in different ways, what happens? Is one preferred over the other? Would I have to delete one of the config files?

For example: Two configurations - /etc/logrotate.d/A and /etc/logrotate.d/B

Contents of A:

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

Contents of B:

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

Upvotes: 0

Views: 1851

Answers (1)

Grisha Levit
Grisha Levit

Reputation: 8617

In the usual scenario, the files in /etc/logrotate.d are all read in by an include directive in the main /etc/logrotate.conf file. If you have multiple directives matching the same file in such a setup, you will get an error:

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

Upvotes: 2

Related Questions