小编Mik*_*ick的帖子

Logrotate 不压缩

我们将 syslogd 设置为将来自几个不同服务器的所有日志发送到一台服务器中,全部发送到一个名为/var/log/centrallogs.

我们为此目录使用以下日志轮换配置:

/etc/logrotate.d/centrallogs:

/var/log/centrallogs/*log {
        rotate 5
        compress
        missingok
        notifempty
        sharedscripts
        postrotate
        /etc/init.d/httpd restart > /dev/null 2>/dev/null || true
        endscript
}
Run Code Online (Sandbox Code Playgroud)

在测试(使用logrotate -d centrallogs)中,LR 似乎没有尝试进行任何旋转。

这是输出(注意,我已经重命名了站点,但这是我所做的唯一更改):

rotating pattern: /var/log/centrallogs/*log  1048576 bytes (5 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/centrallogs/site1_access.log
  log needs rotating
considering log /var/log/centrallogs/site1_error.log
  log does not need rotating
considering log /var/log/centrallogs/site2_access.log
  log needs rotating
considering log /var/log/centrallogs/site2_error.log
  log needs rotating
considering log /var/log/centrallogs/site3_access.log
  log …
Run Code Online (Sandbox Code Playgroud)

linux logrotate centos6

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

centos6 ×1

linux ×1

logrotate ×1