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에서 이동 됨]
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 1130 | 18년 전 | 2462 | ||
| 1129 | 18년 전 | 2445 | ||
| 1128 | 18년 전 | 2316 | ||
| 1127 | 18년 전 | 2549 | ||
| 1126 |
|
18년 전 | 3846 | |
| 1125 | 18년 전 | 3646 | ||
| 1124 |
|
18년 전 | 2078 | |
| 1123 | 18년 전 | 2015 | ||
| 1122 | 18년 전 | 1552 | ||
| 1121 | 18년 전 | 3880 | ||
| 1120 | 18년 전 | 5889 | ||
| 1119 | 18년 전 | 6977 | ||
| 1118 | 18년 전 | 2460 | ||
| 1117 |
BEST79
|
18년 전 | 2705 | |
| 1116 | 18년 전 | 4173 | ||
| 1115 | 18년 전 | 2168 | ||
| 1114 |
|
18년 전 | 3620 | |
| 1113 | 18년 전 | 2867 | ||
| 1112 | 18년 전 | 2723 | ||
| 1111 | 18년 전 | 2191 | ||
| 1110 | 18년 전 | 2459 | ||
| 1109 | 18년 전 | 2590 | ||
| 1108 | 18년 전 | 3080 | ||
| 1107 | 18년 전 | 3725 | ||
| 1106 | 18년 전 | 3264 | ||
| 1105 | 18년 전 | 2771 | ||
| 1104 |
|
18년 전 | 2265 | |
| 1103 | 18년 전 | 2933 | ||
| 1102 | 18년 전 | 3021 | ||
| 1101 | 18년 전 | 2534 | ||
| 1100 | 18년 전 | 2294 | ||
| 1099 | 18년 전 | 3323 | ||
| 1098 | 18년 전 | 4844 | ||
| 1097 | 18년 전 | 5067 | ||
| 1096 | 18년 전 | 2286 | ||
| 1095 | 18년 전 | 2182 | ||
| 1094 | 18년 전 | 4993 | ||
| 1093 | 18년 전 | 8952 | ||
| 1092 | 18년 전 | 2036 | ||
| 1091 |
DeepnBlue
|
18년 전 | 4916 | |
| 1090 |
|
18년 전 | 4361 | |
| 1089 |
도날드주주
|
18년 전 | 2601 | |
| 1088 |
|
18년 전 | 4957 | |
| 1087 | 18년 전 | 2783 | ||
| 1086 | 18년 전 | 3665 | ||
| 1085 | 18년 전 | 2613 | ||
| 1084 | 18년 전 | 3426 | ||
| 1083 | 18년 전 | 1938 | ||
| 1082 | 18년 전 | 5370 | ||
| 1081 | 18년 전 | 1684 | ||
| 1080 | 18년 전 | 6045 | ||
| 1079 |
|
18년 전 | 2871 | |
| 1078 | 18년 전 | 6031 | ||
| 1077 |
|
18년 전 | 6832 | |
| 1076 | 18년 전 | 3725 | ||
| 1075 | 18년 전 | 2202 | ||
| 1074 |
hwatta
|
18년 전 | 2093 | |
| 1073 | 18년 전 | 6892 | ||
| 1072 | 18년 전 | 2388 | ||
| 1071 | 18년 전 | 3944 | ||
| 1070 |
|
18년 전 | 5341 | |
| 1069 | 18년 전 | 2688 | ||
| 1068 | 18년 전 | 1734 | ||
| 1067 | 18년 전 | 1567 | ||
| 1066 | 18년 전 | 1516 | ||
| 1065 | 18년 전 | 1796 | ||
| 1064 | 18년 전 | 1785 | ||
| 1063 | 18년 전 | 1773 | ||
| 1062 | 18년 전 | 1712 | ||
| 1061 | 18년 전 | 2501 | ||
| 1060 | 18년 전 | 2301 | ||
| 1059 | 18년 전 | 3461 | ||
| 1058 | 18년 전 | 2588 | ||
| 1057 | 18년 전 | 2573 | ||
| 1056 | 18년 전 | 3408 | ||
| 1055 | 18년 전 | 4620 | ||
| 1054 | 18년 전 | 2958 | ||
| 1053 | 18년 전 | 2795 | ||
| 1052 | 18년 전 | 3342 | ||
| 1051 | 18년 전 | 6274 | ||
| 1050 | 18년 전 | 2177 | ||
| 1049 | 18년 전 | 1986 | ||
| 1048 | 18년 전 | 1936 | ||
| 1047 | 18년 전 | 2001 | ||
| 1046 | 18년 전 | 3188 | ||
| 1045 | 18년 전 | 2258 | ||
| 1044 | 18년 전 | 1947 | ||
| 1043 | 18년 전 | 1616 | ||
| 1042 | 18년 전 | 2076 | ||
| 1041 | 18년 전 | 3356 | ||
| 1040 | 18년 전 | 3225 | ||
| 1039 | 18년 전 | 1907 | ||
| 1038 | 18년 전 | 1479 | ||
| 1037 | 18년 전 | 3179 | ||
| 1036 | 18년 전 | 2053 | ||
| 1035 | 18년 전 | 1613 | ||
| 1034 | 18년 전 | 2836 | ||
| 1033 | 18년 전 | 1963 | ||
| 1032 | 18년 전 | 1840 | ||
| 1031 | 18년 전 | 1809 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기