logrotate configuration file syntax - multiple wildcard entries possible?

Yes, you can use multiple wild cards. You can test your file without performing the actual rotations by doing this:

logrotate -d -f /etc/logrotate.conf
  • -d = Turns on debug mode. In debug mode, no changes will be made to the logs or to the logrotate state file.

  • -f = Tells logrotate to force the rotation, even if it doesn’t think this is necessary. Sometimes this is useful after adding new entries to logrotate, or if old log files have been removed by hand, as the new files will be created, and logging will con- tinue correctly.`


I just wanted to clarify, because that's what I got here looking how to do,

Multiple log files are allowed to be specified for a single config, eg

/var/log/httpd/access.log
/var/log/httpd/error.log
/var/log/httpd/mysite/*.log
{
    rotate 5
    mail [email protected]
    size 100k
    sharedscripts
    postrotate
        /usr/bin/killall -HUP httpd
    endscript
}

From man page for logrotate:

Note that log file names may be enclosed in quotes (and that quotes are required if the name contains spaces). Normal shell quoting rules apply, with ', ", and \ characters supported.

Please remember to modify or remove quotation marks when going from single to multiple patterns:

This works:

/var/log/*.log /var/log/*.blog {

this works too:

/var/log/*.log
/var/log/*.blog {

This does not work:

'/var/log/*.log /var/log/*.blog' {

and neither this:

"/var/log/*.log /var/log/*.blog" {

Compare with the single pattern case.

This works:

'/var/log/*.log' {

and this works too:

"/var/log/*.log" {

Tested with logrotate 3.10.0