zoukankan      html  css  js  c++  java
  • logrotate 不生效

    登录服务器查看,发现日志没有自动切割。去查看micros配置文件:

    [root@ecs-11-151 ~]# cat /etc/logrotate.d/micros 
    /data/logs/*/*.log {
     rotate 3
     copytruncate
     daily
     dateext
     compress
     missingok
    }
    

    看着没什么问题,手动执行看看

    [root@ecs-11-150 logrotate.d]# logrotate -vf micros 
    reading config file micros
    Allocating hash table for state file, size 15360 B
    
    Handling 1 logs
    
    rotating pattern: /data/logs/*/*.log  forced from command line (3 rotations)
    empty log files are rotated, old logs are removed
    considering log /data/logs/cloud/accumulationfund-service.log
    error: skipping "/data/logs/cloud/accumulationfund-service.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.
    considering log /data/logs/cloud/bill-cloud.log
    error: skipping "/data/logs/cloud/bill-cloud.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.
    

    大意是日志文件所在父目录有不安全的权限,需要在配置文件设置su项

    去查看日志目录,发现为了方便开发看日志,目录都改为 777 权限了。

    将配置文件改为如下:

    [root@ecs-11-151 ~]# cat /etc/logrotate.d/micros 
    /data/logs/*/*.log {
     rotate 3
     su root root
     copytruncate
     daily
     dateext
     compress
     missingok
    }
    

    手动执行下:

    logrotate -vf micros
    

    去看下日志文件有没有处理

    [root@ecs-11-151 service]# ls
    apiAuth-service.log             
    apiAuth-service.log-20190701.gz 
    app-provider.log                
    app-provider.log-20190701.gz    
    
  • 相关阅读:
    centos7.6 使用yum安装mysql5.7
    解决hadoop本地库问题
    docker-compose 启动警告
    docker 安装zabbix5.0 界面乱码问题解决
    docker 部署zabbix问题
    zookeeper 超时问题
    hbase regionserver异常宕机
    (转载)hadoop 滚动升级
    hadoop Requested data length 86483783 is longer than maximum configured RPC length
    zkfc 异常退出问题,报错Received stat error from Zookeeper. code:CONNECTIONLOSS
  • 原文地址:https://www.cnblogs.com/fsckzy/p/11158675.html
Copyright © 2011-2022 走看看