I have a a few processes that output logs to /var/tmp/
and /tmp/
. I am trying to get logrotate to work on them using a file I have put in /etc/logrotate.d/
.
One set of files is generated by rsyslog
utility (where I capture the output and act on it on a separate script)
For the life of me , I can't figure out why logrotate
in systemd
never runs my config. Manual running always works with no errors.
# laxfw logrotate files - an addition to rsyslog logrotate
sharedscripts
/var/tmp/laxfw.log
/var/tmp/laxauth.log
/tmp/laxfw.log
/tmp/laxauth.log
/var/log/laxfw.log
/var/log/laxauth.log
{
rotate 7
daily
missingok
notifempty
# delaycompress
compress
su syslog syslog
create 0664 syslog syslog
prerotate
/usr/local/laxfw/laxfw.prerotate.sh "$1"
endscript
postrotate
/usr/local/laxfw/laxfw.postrotate.sh "$1"
endscript
}
/tmp/laxabuse.log
/var/tmp/laxabuse.log
{
rotate 7
daily
missingok
notifempty
# delaycompress
compress
su root root
prerotate
/usr/local/laxfw/laxfw.prerotate.sh "$1"
endscript
postrotate
/usr/local/laxfw/laxfw.postrotate.sh "$1"
endscript
}
I have tried moving the logs to different directories. I have changed the apparmor permissons to these files. I have added prerotate and posrotate scripts that will capture attempts
Running with --debug
or --verbose
yields nothing I can find.
What am I missing?
-- EDIT --
Relevant output for --debug
option:
logrotate --debug /etc/logrotate.conf
...
reading config file laxfw.logrotate
...
rotating pattern: /var/tmp/laxfw.log
/var/tmp/laxauth.log
/tmp/laxfw.log
/tmp/laxauth.log
/var/log/laxfw.log
/var/log/laxauth.log
after 1 days (7 rotations)
empty log files are not rotated, old logs are removed
switching euid to 104 and egid to 110
considering log /var/tmp/laxfw.log
Now: 2022-04-03 14:08
Last rotated at 2022-04-01 09:28
log needs rotating
considering log /var/tmp/laxauth.log
Now: 2022-04-03 14:08
Last rotated at 2022-04-01 09:28
log needs rotating
considering log /tmp/laxfw.log
log /tmp/laxfw.log does not exist -- skipping
considering log /tmp/laxauth.log
log /tmp/laxauth.log does not exist -- skipping
considering log /var/log/laxfw.log
log /var/log/laxfw.log does not exist -- skipping
considering log /var/log/laxauth.log
log /var/log/laxauth.log does not exist -- skipping
rotating log /var/tmp/laxfw.log, log->rotateCount is 7
dateext suffix '-20220403'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /var/tmp/laxfw.log.7.gz to /var/tmp/laxfw.log.8.gz (rotatecount 7, logstart 1, i 7),
renaming /var/tmp/laxfw.log.6.gz to /var/tmp/laxfw.log.7.gz (rotatecount 7, logstart 1, i 6),
renaming /var/tmp/laxfw.log.5.gz to /var/tmp/laxfw.log.6.gz (rotatecount 7, logstart 1, i 5),
renaming /var/tmp/laxfw.log.4.gz to /var/tmp/laxfw.log.5.gz (rotatecount 7, logstart 1, i 4),
renaming /var/tmp/laxfw.log.3.gz to /var/tmp/laxfw.log.4.gz (rotatecount 7, logstart 1, i 3),
renaming /var/tmp/laxfw.log.2.gz to /var/tmp/laxfw.log.3.gz (rotatecount 7, logstart 1, i 2),
renaming /var/tmp/laxfw.log.1.gz to /var/tmp/laxfw.log.2.gz (rotatecount 7, logstart 1, i 1),
renaming /var/tmp/laxfw.log.0.gz to /var/tmp/laxfw.log.1.gz (rotatecount 7, logstart 1, i 0),
log /var/tmp/laxfw.log.8.gz doesn't exist -- won't try to dispose of it
rotating log /var/tmp/laxauth.log, log->rotateCount is 7
dateext suffix '-20220403'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /var/tmp/laxauth.log.7.gz to /var/tmp/laxauth.log.8.gz (rotatecount 7, logstart 1, i 7),
renaming /var/tmp/laxauth.log.6.gz to /var/tmp/laxauth.log.7.gz (rotatecount 7, logstart 1, i 6),
renaming /var/tmp/laxauth.log.5.gz to /var/tmp/laxauth.log.6.gz (rotatecount 7, logstart 1, i 5),
renaming /var/tmp/laxauth.log.4.gz to /var/tmp/laxauth.log.5.gz (rotatecount 7, logstart 1, i 4),
renaming /var/tmp/laxauth.log.3.gz to /var/tmp/laxauth.log.4.gz (rotatecount 7, logstart 1, i 3),
renaming /var/tmp/laxauth.log.2.gz to /var/tmp/laxauth.log.3.gz (rotatecount 7, logstart 1, i 2),
renaming /var/tmp/laxauth.log.1.gz to /var/tmp/laxauth.log.2.gz (rotatecount 7, logstart 1, i 1),
renaming /var/tmp/laxauth.log.0.gz to /var/tmp/laxauth.log.1.gz (rotatecount 7, logstart 1, i 0),
log /var/tmp/laxauth.log.8.gz doesn't exist -- won't try to dispose of it
running prerotate script
running script with arg /var/tmp/laxfw.log
/var/tmp/laxauth.log
/tmp/laxfw.log
/tmp/laxauth.log
/var/log/laxfw.log
/var/log/laxauth.log
: "
/usr/local/laxfw/laxfw.prerotate.sh "$1"
"
renaming /var/tmp/laxfw.log to /var/tmp/laxfw.log.1
creating new /var/tmp/laxfw.log mode = 0664 uid = 104 gid = 110
renaming /var/tmp/laxauth.log to /var/tmp/laxauth.log.1
creating new /var/tmp/laxauth.log mode = 0664 uid = 104 gid = 110
running postrotate script
running script with arg /var/tmp/laxfw.log
/var/tmp/laxauth.log
/tmp/laxfw.log
/tmp/laxauth.log
/var/log/laxfw.log
/var/log/laxauth.log
: "
/usr/local/laxfw/laxfw.postrotate.sh "$1"
"
compressing log with: /bin/gzip
compressing log with: /bin/gzip
switching euid to 0 and egid to 0
rotating pattern: /tmp/laxabuse.log
/var/tmp/laxabuse.log
after 1 days (7 rotations)
empty log files are not rotated, old logs are removed
considering log /tmp/laxabuse.log
log /tmp/laxabuse.log does not exist -- skipping
considering log /var/tmp/laxabuse.log
Now: 2022-04-03 14:08
Last rotated at 2022-04-01 09:28
log needs rotating
rotating log /var/tmp/laxabuse.log, log->rotateCount is 7
dateext suffix '-20220403'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /var/tmp/laxabuse.log.7.gz to /var/tmp/laxabuse.log.8.gz (rotatecount 7, logstart 1, i 7),
renaming /var/tmp/laxabuse.log.6.gz to /var/tmp/laxabuse.log.7.gz (rotatecount 7, logstart 1, i 6),
renaming /var/tmp/laxabuse.log.5.gz to /var/tmp/laxabuse.log.6.gz (rotatecount 7, logstart 1, i 5),
renaming /var/tmp/laxabuse.log.4.gz to /var/tmp/laxabuse.log.5.gz (rotatecount 7, logstart 1, i 4),
renaming /var/tmp/laxabuse.log.3.gz to /var/tmp/laxabuse.log.4.gz (rotatecount 7, logstart 1, i 3),
renaming /var/tmp/laxabuse.log.2.gz to /var/tmp/laxabuse.log.3.gz (rotatecount 7, logstart 1, i 2),
renaming /var/tmp/laxabuse.log.1.gz to /var/tmp/laxabuse.log.2.gz (rotatecount 7, logstart 1, i 1),
renaming /var/tmp/laxabuse.log.0.gz to /var/tmp/laxabuse.log.1.gz (rotatecount 7, logstart 1, i 0),
log /var/tmp/laxabuse.log.8.gz doesn't exist -- won't try to dispose of it
running prerotate script
running script with arg /tmp/laxabuse.log
/var/tmp/laxabuse.log
: "
/usr/local/laxfw/laxfw.prerotate.sh "$1"
"
renaming /var/tmp/laxabuse.log to /var/tmp/laxabuse.log.1
creating new /var/tmp/laxabuse.log mode = 0644 uid = 0 gid = 0
running postrotate script
running script with arg /tmp/laxabuse.log
/var/tmp/laxabuse.log
: "
/usr/local/laxfw/laxfw.postrotate.sh "$1"
"
compressing log with: /bin/gzip
The existing .#.gz
files were created by running by hand