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
logrotate 不生效的更多相关文章
- Linux日志切割方法[Logrotate、python、shell实现方式]
Linux日志切割方法[Logrotate.python.shell实现方式] 对于Linux系统安全来说,日志文件是极其重要的工具.不知为何,我发现很多运维同学的服务器上都运行着一些诸如每天切分 ...
- logrotate机制与原理[转载]
http://blog.lightxue.com/how-logrotate-works/ 日志实在是太有用了,它记录了程序运行时各种信息.通过日志可以分析用户行为,记录运行轨迹,查找程序问题.可惜磁 ...
- logrotate关于日志轮询和分割
如果你的是源码包安装的服务,那么对于Linux服务器上的一些服务在运行当中产生的日志很重要,可以判断你的服务是否有异常等,但源码包安装的日志是没有日志的轮询或者说是切割能力的, 所以你就需要用到bas ...
- 如何在Centos 7上用Logrotate管理日志文件
何为Logrotate? Logrotate是一个实用的日志管理工具,旨在简化对系统上生成大量的日志文件进行管理. Logrotate允许自动旋转压缩,删除和邮寄日志文件,从而节省宝贵的磁盘空间. L ...
- rsyslog和logrotate
简介 rsyslog 是一个 syslogd 的多线程增强版. 现在Fedora和Ubuntu, rhel6默认的日志系统都是rsyslog了 rsyslog负责写入日志, logrotate负责备份 ...
- rsyslog和logrotate服务
参考: http://www.lampbo.org/others/opensource/rsyslog-config-file-detail.html http://bangerlee.blog.ch ...
- logrotate日志转储
1 工具目录 ***系统开启selinux,logrotate会不生效*** linux默认会安装logrotate工具,自身的boot.log就是通过它分割转储的. [root@webmaster ...
- 利用Linux自带的logrotate管理日志
日常运维中,经常要对各类日志进行管理,清理,监控,尤其是因为应用bug,在1小时内就能写几十个G日志,导致磁盘爆满,系统挂掉. nohup.out,access.log,catalina.out 本文 ...
- Nginx 日志切割(Logrotate)
Logrotate 配置文件 # ls /etc/logrotate.* /etc/logrotate.conf /etc/logrotate.d: cups dracut fmdcn httpd i ...
随机推荐
- 洛谷 P1640 【连续攻击游戏】
question bank :luogu question Number :1640 title :Continuous attacking game link :https://www.luogu. ...
- CF Edu54 E. Vasya and a Tree DFS+树状数组
Vasya and a Tree 题意: 给定一棵树,对树有3e5的操作,每次操作为,把树上某个节点的不超过d的子节点都加上值x; 思路: 多开一个vector记录每个点上的操作.dfs这颗树,同时以 ...
- CodeForces 507E Breaking Good 2维权重dij
Breaking Good 题解: 2维权重dij, 先距离最短, 后改变最小. 在这个题中, 如果要改变最小, 则让更多的可用边放进来. 然后可以用pre存下关键边. 代码: ...
- codeforces 688 E. The Values You Can Make(01背包+思维)
题目链接:http://codeforces.com/contest/688/problem/E 题解:设dp[s1][s2]表示s1状态下出现s2是否合理.那么s1显然可以更具01背包来得到状态.首 ...
- poj 1177 Picture(线段树周长并)
题目链接:http://poj.org/problem?id=1177 题意:给你n个矩形问你重叠后外边缘总共多长. 周长并与面积并很像只不过是处理的时候是 增加的周长=abs(上一次的线段的长度 ...
- CentOS配置服务开机自启
本例子以nginx作为举例: CentOS7中 以systemctl 替代了chkconfig 进行服务的管理, 默认在CentOS6 中控制服务开机自启,是在vim /etc/rc.d/rc.loc ...
- Java中ElasticSearch的删除示例
public class DeleteElasticAPI { private static RestClient restClient; static { restClient=RestClient ...
- C#中读写Xml配置文件常用方法工具类
场景 有时需要使用配置文件保存一些配置的属性,使其在下次打开时设置仍然生效. 这里以对xml配置文件的读写为例. 1.读取XML配置文. 2.写入XML配置文件. 3.匹配 XPath 表达式的第一个 ...
- HBase WAL原理学习
1.概述 客户端往RegionServer端提交数据的时候,会写WAL日志,只有当WAL日志写成功以后,客户端才会被告诉提交数据成功,如果写WAL失败会告知客户端提交失败,换句话说这其实是一个数据落地 ...
- Linux 笔记 - 第十二章 Shell 脚本
博客地址:http://www.moonxy.com 一.前言 常见的编程语言分为两类:一类是编译型语言,如:C.C++ 和 Java等,它们远行前要经过编译器的编译.另一类是解释型语言,不需要编译, ...