登录服务器查看,发现日志没有自动切割。去查看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

logrotate 不生效的更多相关文章

  1. Linux日志切割方法[Logrotate、python、shell实现方式]

    Linux日志切割方法[Logrotate.python.shell实现方式] ​ 对于Linux系统安全来说,日志文件是极其重要的工具.不知为何,我发现很多运维同学的服务器上都运行着一些诸如每天切分 ...

  2. logrotate机制与原理[转载]

    http://blog.lightxue.com/how-logrotate-works/ 日志实在是太有用了,它记录了程序运行时各种信息.通过日志可以分析用户行为,记录运行轨迹,查找程序问题.可惜磁 ...

  3. logrotate关于日志轮询和分割

    如果你的是源码包安装的服务,那么对于Linux服务器上的一些服务在运行当中产生的日志很重要,可以判断你的服务是否有异常等,但源码包安装的日志是没有日志的轮询或者说是切割能力的, 所以你就需要用到bas ...

  4. 如何在Centos 7上用Logrotate管理日志文件

    何为Logrotate? Logrotate是一个实用的日志管理工具,旨在简化对系统上生成大量的日志文件进行管理. Logrotate允许自动旋转压缩,删除和邮寄日志文件,从而节省宝贵的磁盘空间. L ...

  5. rsyslog和logrotate

    简介 rsyslog 是一个 syslogd 的多线程增强版. 现在Fedora和Ubuntu, rhel6默认的日志系统都是rsyslog了 rsyslog负责写入日志, logrotate负责备份 ...

  6. rsyslog和logrotate服务

    参考: http://www.lampbo.org/others/opensource/rsyslog-config-file-detail.html http://bangerlee.blog.ch ...

  7. logrotate日志转储

    1 工具目录 ***系统开启selinux,logrotate会不生效*** linux默认会安装logrotate工具,自身的boot.log就是通过它分割转储的. [root@webmaster ...

  8. 利用Linux自带的logrotate管理日志

    日常运维中,经常要对各类日志进行管理,清理,监控,尤其是因为应用bug,在1小时内就能写几十个G日志,导致磁盘爆满,系统挂掉. nohup.out,access.log,catalina.out 本文 ...

  9. Nginx 日志切割(Logrotate)

    Logrotate 配置文件 # ls /etc/logrotate.* /etc/logrotate.conf /etc/logrotate.d: cups dracut fmdcn httpd i ...

随机推荐

  1. tit文件的加密解密

    加密 # hello 源文件 # ifmmp 加密 # hello 解密 file = open("Email.txt","r") # 源文件 只针对字符不需要 ...

  2. light 1205 - Palindromic Numbers(数位dp)

    题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1205 题解:这题作为一个数位dp,是需要咚咚脑子想想的.这个数位dp方程可能不 ...

  3. js-DOM ~ 04. BOM:浏览器对象模型window. 、定时器、在线用户、祝愿墙、BOM的内置方法内置对象

    multiple. select列表多选 触发事件后调用有参数的函数要先创建一个函数,然后在函数内调用执行函数 Array.from(伪数组):伪数组变为真数组 indexOf():查询字符的索引 a ...

  4. Day004课程内容

    本节主要内容: 1.列表List L = [1,'哈哈哈','吼吼',[1,8,0],('"我“,"叫","元","组"),”ab ...

  5. UI自动化测试养成记

    <selenium自动化测试实战>PDF文档下载:https://pan.baidu.com/s/16dt8qPi-C4BOgKe6snAA0A 这几个月我都干了些什么? 当我打算写一本& ...

  6. springboot使用Jpa连接数据库

    springboot使用Jpa连接数据库 1.pom.xml: <?xml version="1.0" encoding="UTF-8"?> < ...

  7. IDEA中工程上传到SVN

    1.先在IDEA上集成SVN 2.查看SVN仓库:连接SVN ①此时应该先去SVN服务器中新建一个SVN服务: 点击下一步 点击下一步 点击create ②查看SVN仓库 先复制SVN的地址 把复制的 ...

  8. 调整linux系统时间和硬件时间

    1.yum -y install ntp 2.cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime(如果拷贝失败,可以  mv /etc/localt ...

  9. mapper 传多个参数

    Mybatis的Mapper接口的参数,一般是一个对象,但如果不是对象,并且有多个参数的时候呢?我们第一个的想法是把参数封装成一个java.util.Map类型,然后在方法的注释上面写上map的key ...

  10. maven环境变量设置

    maven环境变量设置 maven环境变量设置 wondows 一.下载 开源网址:http://maven.apache.org/ 下载网址:http://maven.apache.org/down ...