250x250
반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
Tags
- Apache
- Mac
- wordpress
- new user
- centos
- home page
- DOM Parser
- root
- MariaDB
- non-www
- Google Cloud
- 구글 클라우드
- php
- git pull
- https
- SSL
- CentOS7
- LetsEncrypt
- Xdebug
- Liniux
- launch.json
- crontab
- Certbot
- vscode
- Linux
- Fail2ban
- front page
- child theme
- mysql
- html
Archives
- Today
- Total
between 0 and 1
MARIADB LOG ROTATION 본문
728x90
반응형
- general configuration file is located under /etc/logrotate.conf
- specific changes are under /etc/logrotate.d
By default the logrotate job is started once a day by OS cron.daily job
(/etc/cron.daily/logrotate)
database user for log rotation
CREATE USER 'logrotate'@'localhost' IDENTIFIED BY 'secret';
GRANT RELOAD ON *.* to 'logrotate'@'localhost';
database user information (mysql or mariadb)
#
# ~/.logrotate.cnf (chmod 600)
#
[mysql]
user = logrotate
password = secret
log rotation configuration file
#
# /etc/logrotate.d/mysql
#
/var/log/mysql/error.log {
compress
notifempty
size 100M
rotate 5
maxage 365
postrotate
/usr/bin/mysql --defaults-extra-file=~/.logrotate.cnf --user=logrotate --execute='FLUSH ERROR LOGS'
endscript
}
/var/log/mysql/slow.log {
compress
notifempty
weekly
rotate 4
maxage 30
postrotate
/usr/bin/mysql --defaults-extra-file=~/.logrotate.cnf --user=logrotate --execute='FLUSH SLOW LOGS'
endscript
}
/var/log/mysql/general.log {
compress
notifempty
size 1G
rotate 3
maxage 14
postrotate
/usr/bin/mysql --defaults-extra-file=~/.logrotate.cnf --user=logrotate --execute='FLUSH GENERAL LOGS'
endscript
}
Testing Logrotate
/usr/sbin/logrotate /etc/logrotate.conf
728x90
반응형