Logrotate syntax - use of wildcards

Viewed 20

I'm encountering a failure when doing some logrotate tests. Here's my logrotate config file (line numbers inserted for context with the error):

1 /var/lib/docker/containers/**/*.log {
2   rotate 20
3   hourly
4   minsize 4M
5   copytruncate
6   compress
7   notifempty
8   maxage 30
9   missingok
10 }
11 /var/lib/docker/overlay2/**/*.log {
12  rotate 20
13  hourly
14  minsize 4M
15  copytruncate
16  compress
17  notifempty
18  maxage 30
19  missingok
20 }

However, when running logrotate --force /etc/logrotate.d/, I receive the following error(s), suggesting my config file is entirely broken:

error: smh-log-rotation:1 lines must begin with a keyword or a filename (possibly in double quotes)
error: smh-log-rotation:10, unexpected text after }
error: smh-log-rotation:11 lines must begin with a keyword or a filename (possibly in double quotes)
error: smh-log-rotation:20, unexpected text after }

I've compared with other logrotate config files and my syntax looks okay to me - my only guess is that it's my use of wildcards. The files and folders are numerous and varied, so I essentially want to cover any and all log files within all child folders (and their child folders). But according to here, the use of wildcards is not an issue.

Strangley, I can see that the desired logs are being rotated when logrotate is forced to run, but not automatically. And that still doesn't explain the error message(s).

0 Answers
Related