I have a log that generates a new log file each day. Here is a listing of each log created since I turned on logging:
2019-01-04
2019-01-05
2019-01-06
2019-01-07
2019-01-08
This is the logrotate configuration. I have tried several iterations none of which result in the log being compressed and then "left alone" until it rolls off (hopefully in 90 days).
/etc/logrotate.d/remote
/var/log/remote/*/*[!.]gz
/var/log/remote/*/*.[!g]z
/var/log/remote/*/*.g[!z]
/var/log/remote/*/*[!.][!g]z
/var/log/remote/*/*[!.]g[!z]
/var/log/remote/*/*.[!g][!z]
/var/log/remote/*/*[!.][!g][!z]
{
rotate 90
daily
missingok
compress
}
This is a listing of the folder showing what logrotate is doing.
drwxr-xr-x 2 root root 4.0K Jan 8 06:25 ./
drwxr-xr-x 6 root root 4.0K Jan 4 09:44 ../
-rw-r----- 1 root adm 0 Jan 8 06:25 2019-01-04
-rw-r----- 1 root adm 20 Jan 7 06:25 2019-01-04.1.gz
-rw-r----- 1 root adm 20 Jan 6 06:25 2019-01-04.2.gz
-rw-r----- 1 root adm 5.2K Jan 4 23:57 2019-01-04.3.gz
-rw-r----- 1 root adm 0 Jan 8 06:25 2019-01-05
-rw-r----- 1 root adm 20 Jan 7 06:25 2019-01-05.1.gz
-rw-r----- 1 root adm 20 Jan 6 06:25 2019-01-05.2.gz
-rw-r----- 1 root adm 7.4K Jan 5 23:58 2019-01-05.3.gz
-rw-r----- 1 root adm 0 Jan 8 06:25 2019-01-06
-rw-r----- 1 root adm 20 Jan 7 06:25 2019-01-06.1.gz
-rw-r----- 1 root adm 8.0K Jan 6 23:56 2019-01-06.2.gz
-rw-r----- 1 root adm 0 Jan 8 06:25 2019-01-07
-rw-r----- 1 root adm 7.8K Jan 7 23:55 2019-01-07.1.gz
-rw-r----- 1 root adm 101K Jan 8 13:16 2019-01-08
I want to manage the number of days of logs that are retained and while I'm at it, compress the old logs. This is what I want to end up with:
drwxr-xr-x 2 root root 4.0K Jan 8 06:25 ./
drwxr-xr-x 6 root root 4.0K Jan 4 09:44 ../
-rw-r----- 1 root adm 20 Jan 7 06:25 2019-01-04.1.gz
-rw-r----- 1 root adm 20 Jan 7 06:25 2019-01-05.1.gz
-rw-r----- 1 root adm 20 Jan 7 06:25 2019-01-06.1.gz
-rw-r----- 1 root adm 7.8K Jan 7 23:55 2019-01-07.1.gz
-rw-r----- 1 root adm 101K Jan 8 13:16 2019-01-08