前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Centos6 下 logrotate 探源3

Centos6 下 logrotate 探源3

作者头像
franket
发布2022-07-10 00:02:24
1470
发布2022-07-10 00:02:24
举报
文章被收录于专栏:技术杂记技术杂记

里面还有一个配置文件目录/etc/logrotate.d ,打开它,看看究竟有些什么

代码语言:javascript
复制
[root@Test-slave ~]# ll  /etc/logrotate.d 
total 44
-rw-r--r--. 1 root root  71 Oct 15 23:33 cups
-rw-r--r--. 1 root root 103 Oct 16 05:49 dracut
-rw-r--r--. 1 root root 185 Aug 15  2014 httpd
-rw-r--r--. 1 root root 844 Mar  3 01:43 mysql
-rw-r--r--. 1 root root 136 Aug 23  2010 ppp
-rw-r--r--. 1 root root 329 Jul 17  2012 psacct
-rw-r--r--. 1 root root 210 Aug 15  2013 syslog
-rw-r--r--. 1 root root 100 Feb  4  2013 wpa_supplicant
-rw-r--r--. 1 root root  87 Oct 16 23:15 yum
-rw-r--r--. 1 root root 125 Jan 29  2014 zabbix-agent
-rw-r--r--. 1 root root 140 Jan 29  2014 zabbix-server
[root@Test-slave ~]# 

里面有对不同服务的定制配置,这是一种方便管理的方法,在apache,nginx等里面都是这样的, 我们随便打开一个如mysql,看看里面有些什么

代码语言:javascript
复制
[root@Test-slave ~]# cat /etc/logrotate.d/mysql 
# The log file name and location can be set in
# /etc/my.cnf by setting the "log-error" option
# in either [mysqld] or [mysqld_safe] section as
# follows:
#
# [mysqld]
# log-error=/var/lib/mysql/mysqld.log
#
# In case the root user has a password, then you
# have to create a /root/.my.cnf configuration file
# with the following content:
#
# [mysqladmin]
# password = <secret> 
# user= root
#
# where "<secret>" is the password. 
#
# ATTENTION: The /root/.my.cnf file should be readable
# _ONLY_ by root !

/var/lib/mysql/mysqld.log {
        # create 600 mysql mysql
        notifempty
        daily
        rotate 5
        missingok
        compress
    postrotate
	# just if mysqld is really running
	if test -x /usr/bin/mysqladmin && \
	   /usr/bin/mysqladmin ping &>/dev/null
	then
	   /usr/bin/mysqladmin flush-logs
	fi
    endscript
}
[root@Test-slave ~]# 

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云数据库 MySQL
腾讯云数据库 MySQL(TencentDB for MySQL)为用户提供安全可靠,性能卓越、易于维护的企业级云数据库服务。其具备6大企业级特性,包括企业级定制内核、企业级高可用、企业级高可靠、企业级安全、企业级扩展以及企业级智能运维。通过使用腾讯云数据库 MySQL,可实现分钟级别的数据库部署、弹性扩展以及全自动化的运维管理,不仅经济实惠,而且稳定可靠,易于运维。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档