里面还有一个配置文件目录/etc/logrotate.d ,打开它,看看究竟有些什么
[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,看看里面有些什么
[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 删除。