logrotate失效的简单排查

检查selinux

    确认Selinux已经关闭,Selinux为Permissive时虽然可以日志转储,但 /var/log/messages 有提示信息:
在这里插入图片描述
    当然,如果不关闭Selinux,简单执行一下命令就可以了,参考文献有明确的方法。

检查配置文件

    转储失败提示logrotate: ALERT exited abnormally with [1],截图如下:
在这里插入图片描述
    这条告警是执行 /etc/cron.daily/logrotate 时产生的。解决方法是使用 logrotate -d 逐一检查/etc/logrotate.d下的配置文件。示例产生的告警如下:

error: skipping "/var/log/boot.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.

在这里插入图片描述
    如图所示,由于/var/log文件夹权限问题导致logrotate执行时报错退出,当前权限是777,改成755就好了。

    总结一下,排查步骤为:

  • 检查selinux,尽量改为disabled,省事
  • 使用 logrotate -d 逐一检查配置文件,解决提示的error问题
参考文献

https://access.redhat.com/solutions/32831

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值