I don't know if later versions do, but after researching further I found that shell wildcards are supported. Both
* (match multiple characters) and
? (match a single character) can be combined to match specific files.
As an example, here are patterns which match your use case along with the rest of a file which could be found at
# Look for previously matched log files and rotate daily if found
# use date as a suffix of the rotated file
# Compress log file, optional if the files are small enough
# Allow for a log file pattern to NOT match in order to support both
# filename formats
# Do not create replacement log files, the application will do that
# Keep 30 days worth of rotated logs
However if you intended for
process to be a placeholder for an actual process id, then I believe you can get away with using a wildcard in place of the process id number like so:
I hope this helps. I too went searching for a regex approach that would work and finally decided on the use of shell wildcards instead of what I felt were workable, but more complex solutions.
While searching for a regex solution I found a blog post titled, "Excluding files from logrotate globbing matches" which provided this solution:
bash -c "[[ ! $1 =~ testprogram ]]"
I ended up pulling two items out of that example and modified the match slightly. In my situation I wanted to rotate all files in a directory except for some input files which have a
This is what I came up with:
# Force the prerotate "script" below to be run on each individual file
# in order to verify that it isn't an unprocessed input file
# Skip rotating any unprocessed input files (*.inp extension)
bash -c "[[ ! $1 =~ \.inp$ ]]"
logrotate -d /etc/logrotate.d/myfilename it appears to work. However as I mentioned I opted for the shell wildcards approach as it seemed easier for someone coming behind me to maintain.