ubuntu 20.04.4 上的 logrotate 无法在 systemd 中运行 *我的配置*

ubuntu 20.04.4 上的 logrotate 无法在 systemd 中运行 *我的配置*

我有几个将日志输出到/var/tmp/和 的进程/tmp/。我试图使用我放入 的文件让 logrotate 处理它们/etc/logrotate.d/。一组文件由实用程序生成rsyslog(我在其中捕获输出并在单独的脚本上对其进行操作)

我无论如何也想不通为什么logrotatesystemd从不运行我的配置. 手动运行始终有效,不会出错。

# 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
}

我尝试将日志移动到不同的目录。我已更改这些文件的 apparmor 权限。我添加了 prerotate 和 posrotate 脚本,用于捕获尝试

运行--debug--verbose均无任何结果。

我错过了什么?

-- 编辑 -- 选项的相关输出--debug

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

现有.#.gz文件是通过手动运行创建的

相关内容