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에서 이동 됨]
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 8230 | 9년 전 | 40 | ||
| 8229 | 9년 전 | 47 | ||
| 8228 |
커네드커네드
|
9년 전 | 92 | |
| 8227 | 9년 전 | 100 | ||
| 8226 | 9년 전 | 141 | ||
| 8225 | 9년 전 | 127 | ||
| 8224 | 9년 전 | 125 | ||
| 8223 | 9년 전 | 82 | ||
| 8222 |
|
9년 전 | 160 | |
| 8221 | 9년 전 | 74 | ||
| 8220 | 9년 전 | 68 | ||
| 8219 | 9년 전 | 74 | ||
| 8218 | 9년 전 | 109 | ||
| 8217 |
star3840
|
9년 전 | 90 | |
| 8216 | 9년 전 | 129 | ||
| 8215 | 9년 전 | 82 | ||
| 8214 | 9년 전 | 202 | ||
| 8213 | 9년 전 | 139 | ||
| 8212 | 9년 전 | 52 | ||
| 8211 | 9년 전 | 214 | ||
| 8210 | 9년 전 | 209 | ||
| 8209 | 9년 전 | 314 | ||
| 8208 | 9년 전 | 181 | ||
| 8207 | 9년 전 | 196 | ||
| 8206 |
|
9년 전 | 156 | |
| 8205 | 9년 전 | 142 | ||
| 8204 | 9년 전 | 106 | ||
| 8203 | 9년 전 | 196 | ||
| 8202 | 9년 전 | 123 | ||
| 8201 | 9년 전 | 161 | ||
| 8200 | 9년 전 | 126 | ||
| 8199 | 9년 전 | 174 | ||
| 8198 | 9년 전 | 151 | ||
| 8197 | 9년 전 | 130 | ||
| 8196 | 9년 전 | 507 | ||
| 8195 | 9년 전 | 132 | ||
| 8194 | 9년 전 | 262 | ||
| 8193 | 9년 전 | 128 | ||
| 8192 | 9년 전 | 156 | ||
| 8191 | 9년 전 | 111 | ||
| 8190 | 9년 전 | 107 | ||
| 8189 | 9년 전 | 161 | ||
| 8188 | 9년 전 | 100 | ||
| 8187 | 9년 전 | 118 | ||
| 8186 | 9년 전 | 128 | ||
| 8185 | 9년 전 | 284 | ||
| 8184 | 9년 전 | 80 | ||
| 8183 | 9년 전 | 305 | ||
| 8182 | 9년 전 | 134 | ||
| 8181 | 9년 전 | 106 | ||
| 8180 | 9년 전 | 670 | ||
| 8179 | 9년 전 | 471 | ||
| 8178 | 9년 전 | 275 | ||
| 8177 |
kiplayer
|
9년 전 | 276 | |
| 8176 | 9년 전 | 321 | ||
| 8175 | 9년 전 | 201 | ||
| 8174 | 9년 전 | 209 | ||
| 8173 | 9년 전 | 321 | ||
| 8172 | 9년 전 | 163 | ||
| 8171 | 9년 전 | 157 | ||
| 8170 | 9년 전 | 273 | ||
| 8169 |
커네드커네드
|
9년 전 | 237 | |
| 8168 | 9년 전 | 289 | ||
| 8167 | 9년 전 | 299 | ||
| 8166 | 9년 전 | 209 | ||
| 8165 | 9년 전 | 144 | ||
| 8164 | 9년 전 | 273 | ||
| 8163 | 9년 전 | 263 | ||
| 8162 | 9년 전 | 269 | ||
| 8161 | 9년 전 | 264 | ||
| 8160 |
|
9년 전 | 464 | |
| 8159 | 9년 전 | 378 | ||
| 8158 | 9년 전 | 192 | ||
| 8157 | 9년 전 | 336 | ||
| 8156 | 9년 전 | 251 | ||
| 8155 | 9년 전 | 231 | ||
| 8154 |
00년생용띠
|
9년 전 | 574 | |
| 8153 | 9년 전 | 201 | ||
| 8152 |
|
9년 전 | 378 | |
| 8151 | 9년 전 | 381 | ||
| 8150 | 9년 전 | 470 | ||
| 8149 |
Jangfolk
|
9년 전 | 312 | |
| 8148 | 9년 전 | 145 | ||
| 8147 | 9년 전 | 352 | ||
| 8146 | 9년 전 | 406 | ||
| 8145 | 9년 전 | 329 | ||
| 8144 | 9년 전 | 299 | ||
| 8143 | 9년 전 | 152 | ||
| 8142 | 9년 전 | 400 | ||
| 8141 | 9년 전 | 351 | ||
| 8140 | 9년 전 | 899 | ||
| 8139 | 9년 전 | 224 | ||
| 8138 |
전갈자리남자
|
9년 전 | 365 | |
| 8137 | 9년 전 | 344 | ||
| 8136 | 9년 전 | 711 | ||
| 8135 |
|
9년 전 | 759 | |
| 8134 |
PlayPixel
|
9년 전 | 470 | |
| 8133 |
|
9년 전 | 415 | |
| 8132 | 9년 전 | 428 | ||
| 8131 | 9년 전 | 781 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기