I am using logrotate
version 3.12.3. How do I tell logrotate
to exclude files that are already rotated/compressed?
For example, if I am rotating all files in /var/log
as
"/var/log/*" {
compress
missingok
dateext
rotate 4
size=5000k
}
after a file is compressed, how do I tell logrotate
to not rotate already rotated/compressed files? For example:
/var/log/file1
after logrotation it becomes
/var/log/file1.20211212.gz
I tried
tabooext + .gz
on top of definitions but it doesn't seem to take effect.
From man logrotate
include file_or_directory
Reads the file given as an argument as if it was included inline where the include directive appears. If a directory is given, most of the files in that directory are read in alphabetic order before processing of the including file continues. The only files which are ignored are files which are not regular files (such as directories and named pipes) and files whose names end with one of the taboo extensions, as specified by the tabooext directive.
If something like below worked, that would have been good.
/var/log/*[!".gz"] {
}
Thank you.
EDIT
Maybe do something like
/var/log/*[!.][!g][!z] {
..
}
but it skips file named /var/log/test1gz
. How do I match the .
character with globbing?