论坛风格切换切换到宽版
  • 839阅读
  • 2回复

[问题求助]logrotate 删除文件问题 [复制链接]

上一主题 下一主题
离线森帝.
 
发帖
1943
C币
-61022
威望
362
贡献值
1
银元
-2
铜钱
4367
人人网人气币
0
只看楼主 正序阅读 使用道具 楼主  发表于: 2009-05-01
各位好,我用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域名

---------.-------------              乙肝
谢谢!

评价一下你浏览此帖子的感受

精彩

感动

搞笑

开心

愤怒

无聊

灌水
离线ppcynt.
发帖
1965
C币
-61033
威望
340
贡献值
1
银元
-4
铜钱
4335
人人网人气币
0
只看该作者 板凳  发表于: 2010-04-13
Re:logrotate
晕,你怎么会觉得好玩。
发帖
1963
C币
-140722
威望
350
贡献值
1
银元
-2
铜钱
4425
人人网人气币
0
只看该作者 沙发  发表于: 2010-04-13
回复 1# solink


    haowan~

快速回复
限100 字节
如果您提交过一次失败了,可以用”恢复数据”来恢复帖子内容
 
上一个 下一个