各位好,我用logrotate做Iptable日志轮询的时候出了点.问题,不甚明白,.请求大家帮助!.
我希望.每日logrotate我的日志文件/tmp/.log/iptables,保留60天的记录,下面是我的logrotate配置( 游戏 )
----.--------.-------------------------------------投资
[root@S1~]# mo.re /etc/logrotate.co.nf.
# see ".man logrotate" for d.etails.
# rotate log files we.ekly 鲜花
daily
#. ke.ep 4 weeks worth of backlogs 鲜花
rotate 60
# crea.te new (empty) l.og files after rotating old ones健康
create
# uncomm.ent this if you want your log files co.mpressed.
#compress
# R.PM packages drop lo.g rotation information into this directory 健康
include /etc/l.ogrotate.d.
# .no packages own wtmp -- we'll. rotate them here 杀毒
/var/log/.wtmp { 电子
monthly
minsize 1M
create 06.64 root utmp 外汇
rotate 1
}
# system-spe..cific logs may be also be configured here.外贸
[root@S1~]#. .more /etc/logrotate.d/syslog 外汇
/tmp/lo.g/iptables { 杀毒
daily
rotate 60
missingok
maxage 60
nocompress
create
prerotate
/usr/bin/chattr -a /.t.mp/log/iptables( 游戏 )
endscript
postrotate
/usr/b.i.n/chattr +a /tmp/log/iptables
/bin/kill -HUP `cat /var/.run/syslogd.pid 2> /dev/null` 2> /de.v/null ||. true 婚庆
endscript
}
--------------.---------.--------------.
现在的问题是,日志在轮询到第10天的时候就会把最早一天的日志文件删除掉,最终只能保留10天的.日志。请看下面的l.s结果,最新一天的日志文件是服务器
iptables.1,而ip.tables.12则是最早一天的,ipta.bles.10和iptables.11都不见了,不知道是什么原因,请各位.朋友指点迷津。.
[root@S1 .log]# ls -l域名
总计 28111551
-rw-r--r-- 1 root. root .672768981 03-01 10:46 iptables 女人
-rw-r--r-- .1 root root. 3126740984 03-01 00:01 iptables.1电影
-rw-r--r-- 1 ro.ot root 2254815193 02-18 00:01 ipta.bles.12.
-rw-r--r-- 1 root roo.t 3186926177 02-28 00:01 iptables.2. 电子
-rw-r--r-- 1 root root 3004102337 02-27 00:0.1 iptab.les.3--- 印刷
-.rw-r--r-- 1 root root 3049559214 02-26 00:01 .iptables.4学习
-rw-r--r-- 1 .root root 2537094127 02-25 0.0:01 iptables.5投资
-rw-r--r-.- 1 root root 2867791525 02-24 00.:01 iptables.6.
-rw-r--r-- 1 root root 2753395007. 02-23 00:01 iptabl.es.7 杀毒
-rw-r--r-- 1 root root 267611776.9 02-22 00:01 .iptables.8.
-rw-r--r-- 1 root root .2628795239 02-21 00.:01 iptables.9域名
---------.------------- 乙肝
谢谢!