linux logrotate

Linux下处理日志,可以使用logrotate

对应的配置文件在/etc/anacrontab

看一下配置文件情况:

  1 # /etc/anacrontab: configuration file for anacron
  2
  3 # See anacron(8) and anacrontab(5) for details.
  4
  5 SHELL=/bin/sh
  6 PATH=/sbin:/bin:/usr/sbin:/usr/bin
  7 MAILTO=root
  8 # the maximal random delay added to the base delay of the jobs
  9 RANDOM_DELAY=45
 10 # the jobs will be started during the following hours only
 11 START_HOURS_RANGE=3-22
 12
 13 #period in days   delay in minutes   job-identifier   command
 14 1       5       cron.daily              nice run-parts /etc/cron.daily
 15 7       25      cron.weekly             nice run-parts /etc/cron.weekly
 16 @monthly 45     cron.monthly            nice run-parts /etc/cron.monthly


配置文件确定的是定期去执行


logrotate对应的每个程序的配置文件在/etc/logrotate.d中

以apache的为例

/var/log/httpd/*log {
    missingok
    notifempty
    sharedscripts
    delaycompress
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值