1 logrotate
sysklogd 가 제어하지 않는 로그를 뱅글뱅글 돌리자.1.1 emerge
emerge logrotate
1.2 cron
하루에 한번 cron 에 의해 실행되도록 한다.mkdir /etc/logrotate.d vi /etc/cron.daily/logrotatesh #!/bin/sh /usr/sbin/logrotate /etc/logrotate.d :wq chmod 700 /etc/cron.daily/logrotatesh
1.3 setting
- 실제 실행될 설정파일. 요점은 로테이트 시킬 로그파일 지정과 로그를 돌린 후 서버의 재시동이다.
- /etc/logrotate.d 에 root.root 600 의 파일로 만든다.
- 예문에 나온것들은 로그용량이 50MB 를 넘기면 교체하도록 되어있다.
- 로그는 10개까지 생성된다.
로그가 도는 모습 예
cd /var/log/apache2 ls -al -rw-r--r-- 1 root root 910 2003-06-09 03:00 access_log -rw-r--r-- 1 root root 51034152 2003-06-09 03:00 access_log.1 -rw-r--r-- 1 root root 64837231 2003-06-08 03:00 access_log.2 -rw-r--r-- 1 root root 57362834 2003-06-07 03:00 access_log.3 -rw-r--r-- 1 root root 58374943 2003-06-06 03:01 access_log.4 -rw-r--r-- 1 root root 79382834 2003-06-05 03:00 access_log.5 -rw-r--r-- 1 root root 56384926 2003-06-03 03:01 access_log.6 -rw-r--r-- 1 root root 53823232 2003-06-01 03:00 access_log.7 -rw-r--r-- 1 root root 52344223 2003-05-26 03:00 access_log.8 -rw-r--r-- 1 root root 54392345 2003-05-19 03:00 access_log.9
apache2
/var/log/apache2/access_log /var/log/apache2/error_log /var/log/apache2/ssl_access_log /var/log/apache2/ssl_error_log /var/log/apache2/ssl_request_log {
size=50000k
rotate 10
missingok
notifempty
postrotate
/usr/sbin/apache2ctl graceful compress
Old versions of log files are compressed with gzip by default.
See also nocompress.
endscript
}
mysql
/var/log/mysql/mysql.log /var/log/mysql/mysql.err {
size=50000k
rotate 10
missingok
notifempty
postrotate
/usr/bin/mysqladmin refresh -uroot -pmysqlpassword
endscript
}
qmail
/var/log/qmail/qmail-smtpd/current /var/log/qmail/qmail-send/current {
size=50000k
rotate 10
missingok
notifempty
postrotate
/usr/bin/svc -t /service/qmail-s*
endscript
}
2 응용
매일같이 DB를 백업하되 열흘분만 남긴다.mysql_db_backup
/yourmysqldbbackupdirectory/all_databases.sql {
size=1
rotate 10
missingok
notifempty
postrotate
/usr/bin/mysqldump --all-databases > /yourmysqldbbackupdirectory/all_databases.sql
endscript
}
3 질문과 답변
4 잡담
- 압축만 되면 더이상 바랄게 없습니다. -송효진
옵션중에 compress 란것이 있습니다. logrotate(8) 페이지를 참고. -- mithrandir
[이 게시물은 관리자님에 의해 2011-10-31 17:32:05 Linux에서 이동 됨]
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7830 | 9년 전 | 418 | ||
| 7829 |
|
9년 전 | 613 | |
| 7828 | 9년 전 | 538 | ||
| 7827 | 9년 전 | 429 | ||
| 7826 | 9년 전 | 434 | ||
| 7825 | 10년 전 | 478 | ||
| 7824 | 10년 전 | 445 | ||
| 7823 | 10년 전 | 380 | ||
| 7822 | 10년 전 | 359 | ||
| 7821 | 10년 전 | 309 | ||
| 7820 | 10년 전 | 348 | ||
| 7819 |
|
10년 전 | 751 | |
| 7818 | 10년 전 | 389 | ||
| 7817 | 10년 전 | 521 | ||
| 7816 | 10년 전 | 407 | ||
| 7815 | 10년 전 | 608 | ||
| 7814 | 10년 전 | 434 | ||
| 7813 | 10년 전 | 374 | ||
| 7812 | 10년 전 | 399 | ||
| 7811 | 10년 전 | 391 | ||
| 7810 | 10년 전 | 564 | ||
| 7809 | 10년 전 | 492 | ||
| 7808 | 10년 전 | 377 | ||
| 7807 | 10년 전 | 403 | ||
| 7806 |
프로그래머7
|
10년 전 | 1333 | |
| 7805 | 10년 전 | 1275 | ||
| 7804 |
zahir1312
|
10년 전 | 777 | |
| 7803 |
|
10년 전 | 1374 | |
| 7802 | 10년 전 | 457 | ||
| 7801 | 10년 전 | 859 | ||
| 7800 | 10년 전 | 1085 | ||
| 7799 | 10년 전 | 555 | ||
| 7798 | 10년 전 | 509 | ||
| 7797 | 10년 전 | 505 | ||
| 7796 | 10년 전 | 353 | ||
| 7795 | 10년 전 | 503 | ||
| 7794 | 10년 전 | 551 | ||
| 7793 | 10년 전 | 1055 | ||
| 7792 | 10년 전 | 470 | ||
| 7791 | 10년 전 | 556 | ||
| 7790 | 10년 전 | 504 | ||
| 7789 |
fbastore
|
10년 전 | 1448 | |
| 7788 | 10년 전 | 545 | ||
| 7787 | 10년 전 | 399 | ||
| 7786 | 10년 전 | 589 | ||
| 7785 | 10년 전 | 583 | ||
| 7784 | 10년 전 | 644 | ||
| 7783 | 10년 전 | 446 | ||
| 7782 | 10년 전 | 490 | ||
| 7781 | 10년 전 | 898 | ||
| 7780 | 10년 전 | 814 | ||
| 7779 | 10년 전 | 775 | ||
| 7778 | 10년 전 | 364 | ||
| 7777 | 10년 전 | 453 | ||
| 7776 | 10년 전 | 459 | ||
| 7775 | 10년 전 | 408 | ||
| 7774 | 10년 전 | 631 | ||
| 7773 | 10년 전 | 382 | ||
| 7772 | 10년 전 | 733 | ||
| 7771 | 10년 전 | 387 | ||
| 7770 | 10년 전 | 642 | ||
| 7769 | 10년 전 | 380 | ||
| 7768 | 10년 전 | 611 | ||
| 7767 | 10년 전 | 1171 | ||
| 7766 | 10년 전 | 492 | ||
| 7765 | 10년 전 | 524 | ||
| 7764 |
잘살아보자
|
10년 전 | 389 | |
| 7763 |
|
10년 전 | 1457 | |
| 7762 |
Tosea
|
10년 전 | 1052 | |
| 7761 | 10년 전 | 645 | ||
| 7760 |
잘살아보자
|
10년 전 | 675 | |
| 7759 |
잘살아보자
|
10년 전 | 506 | |
| 7758 |
잘살아보자
|
10년 전 | 591 | |
| 7757 | 10년 전 | 1246 | ||
| 7756 |
ITBANK
|
10년 전 | 1252 | |
| 7755 | 10년 전 | 1929 | ||
| 7754 | 10년 전 | 1053 | ||
| 7753 | 10년 전 | 884 | ||
| 7752 | 10년 전 | 1393 | ||
| 7751 |
잘살아보자
|
10년 전 | 531 | |
| 7750 |
잘살아보자
|
10년 전 | 475 | |
| 7749 |
잘살아보자
|
10년 전 | 488 | |
| 7748 |
잘살아보자
|
10년 전 | 494 | |
| 7747 |
잘살아보자
|
10년 전 | 586 | |
| 7746 |
잘살아보자
|
10년 전 | 673 | |
| 7745 |
잘살아보자
|
10년 전 | 916 | |
| 7744 |
잘살아보자
|
10년 전 | 415 | |
| 7743 | 10년 전 | 946 | ||
| 7742 |
starbros
|
10년 전 | 840 | |
| 7741 |
잘살아보자
|
10년 전 | 671 | |
| 7740 |
잘살아보자
|
10년 전 | 536 | |
| 7739 |
잘살아보자
|
10년 전 | 465 | |
| 7738 |
잘살아보자
|
10년 전 | 532 | |
| 7737 |
잘살아보자
|
10년 전 | 499 | |
| 7736 |
잘살아보자
|
10년 전 | 522 | |
| 7735 |
잘살아보자
|
10년 전 | 850 | |
| 7734 |
잘살아보자
|
10년 전 | 429 | |
| 7733 |
잘살아보자
|
10년 전 | 543 | |
| 7732 |
잘살아보자
|
10년 전 | 696 | |
| 7731 |
잘살아보자
|
10년 전 | 621 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기