MySQL慢查询日志和错误日志按天轮询
问题背景:
为便于问题排查和减小日志文件大小,需对慢查询日志和错误日志按天轮询
轮询脚本(/data/scripts/mysql-log-rotate):
"/data/dbdata/otherlog/slow_query.log" "/data/dbdata/otherlog/mysql_error.log" {
create 660 mysql mysql
dateext
notifempty
daily
maxage 60
rotate 30
missingok
compress
olddir /data/dbdata/otherlog
postrotate
if /usr/local/mysql/bin/mysqladmin ping -uroot -S /var/run/mysql/mysql.sock &>/dev/null; then
/usr/local/mysql/bin/mysqladmin flush-logs -uroot -S /var/run/mysql/mysql.sock
fi
endscript
}
CRONTAB信息:
00 00 * * * (/usr/sbin/logrotate -f /data/scripts/mysql-log-rotate >/dev/null 2>&1)
相关阅读:
相关推荐
CoderToy 2020-11-16
emmm00 2020-11-17
王艺强 2020-11-17
ribavnu 2020-11-16
bianruifeng 2020-11-16
wangshuangbao 2020-11-13
苏康申 2020-11-13
vivenwan 2020-11-13
moyekongling 2020-11-13
云中舞步 2020-11-12
要啥自行车一把梭 2020-11-12
aydh 2020-11-12
kuwoyinlehe 2020-11-12
minerk 2020-11-12
vitasfly 2020-11-12
jazywoo在路上 2020-11-11
敏敏张 2020-11-11
世樹 2020-11-11