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 ...
随机推荐
- MySQL之PXC集群搭建
一.PXC 介绍 1.1 PXC 简介 PXC 是一套 MySQL 高可用集群解决方案,与传统的基于主从复制模式的集群架构相比 PXC 最突出特点就是解决了诟病已久的数据复制延迟问题,基本上可以达到实 ...
- HDU 4719Oh My Holy FFF 线段树+DP
/* ** 日期: 2013-9-12 ** 题目大意:有n个数,划分为多个部分,假设M份,每份不能多于L个.每个数有一个h[i], ** 每份最右边的那个数要大于前一份最右边的那个数.设每份最右边的 ...
- CodeForces 677D. Vanya and Treasure 枚举行列
677D. Vanya and Treasure 题意: 给定一张n*m的图,图上每个点标有1~p的值,你初始在(1,1)点,你必须按照V:1,2,3...p的顺序走图上的点,问你如何走时间最少. 思 ...
- CodeForces 223C Partial Sums 多次前缀和
Partial Sums 题解: 一个数列多次前缀和之后, 对于第i个数来说他的答案就是 ; i <= n; ++i){ ; j <= i; ++j){ b[i] = (b[i] + 1l ...
- whu-contest-2019(online)
比赛网址:http://whu2019.contest.codeforces.com/group/YyBKO8xFiH/contest/102167 赛后总结: T:今天参加了武汉大学校赛网络赛,在c ...
- Git暂存本地代码,强制获取远程最新代码
一:git stash // 把本地修改的代码压到git栈中去 二:git pull // 本地代码压栈之后,pull远程代码会完全覆盖本地代码 三:git stash list // 可以查看 ...
- Java日志之Slf4j,Log4J,logback原理总结
几乎任何应用,一定是需要日志的. 那么,面对种类繁多的日志框架和配置,我们该何去何从? 1.前奏:我是在研究mybatis源码的过程中才意识到需要搞明白日志原理这回事,因为mybatis(和一些其他开 ...
- Elasticsearch之更新
public class UpdateElasticAPI { private static RestClient restClient; static { restClient=RestClient ...
- mybatis-generator:generate 生成代码配置踩坑详解
mybatis-generator:generate 生成代码配置踩坑不少,在此留下笔记以便后续填坑 一.mysql返回时间问题 错误信息: [ERROR] Failed to execute goa ...
- 松软科技课堂:sql函数-AVG
定义和用法 AVG 函数返回数值列的平均值.NULL 值不包括在计算中. SQL AVG() 语法 SELECT AVG(column_name) FROM table_name SQL AVG() ...