1

我有一个文件列表,如果它是一天前的,我希望 logrotate 对其进行压缩。所以我期待TRACE_03.log, TRACE_07.log被压缩,因为它超过 24 小时

# ls -ltr
total 2083312
-rw-r--r--. 1 root root 198176768 Mar 18 01:30 TRACE_03.log
-rw-r-----. 1 root root 198176768 Mar 19 17:19 TRACE_07.log
-rw-r-----. 1 root root 467324318 Mar 19 23:59 TRACE_01.log
-rw-r-----. 1 root root         0 Mar 20 09:27 TRACE_05.log
-rw-r-----. 1 root root         0 Mar 20 09:27 TRACE_06.log
-rw-r-----. 2 root root 634809893 Mar 20 19:45 TRACE.log

现在我的 logrotate.conf

# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# use date as a suffix of the rotated file
dateext

# uncomment this if you want your log files compressed
#compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp {
    monthly
    create 0664 root utmp
        minsize 1M
    rotate 1
}

/var/log/btmp {
    missingok
    monthly
    create 0600 root utmp
    rotate 1
}

对于我的 Trace.log 配置

/var/log/traces/TRACE_*.log{
    daily
    missingok
    compress
    nodateext
    rotate 1
    maxage 1
}

我的配置中缺少什么在这里不起作用?

4

0 回答 0