티스토리 뷰

WEB2.0/프로그래밍

logrotate 설정 파일

나를찾는아이 2013. 9. 17. 15:36
728x90
반응형

centos에 기본적으로 설치되어 있는 logrotate는 매우 간단한 로그관리 도구 입니다.


로그파일이 비정상적으로 커지는것을 방지하고


적당한 주기로 삭제하는데 더 없이 좋은 도구입니다.




설정파일은


/etc/logrotate.conf

/etc/logrotate.d/


에 담겨있습니다.



logrotate.conf 파일을 열면 아래와 같은 내용이 있습니다.



# see "man logrotate" for details
# rotate log files weekly
weekly

→ 로그 기록 주기(주단위)

# keep 4 weeks worth of backlogs
rotate 4

→ 얼마나 보관할지(4주)

# create new (empty) log files after rotating old ones
create

→ rotate 후 새로운 파일을 만들지

# use date as a suffix of the rotated file
dateext
→ rotate된 파일의 파일명에 날짜 붙이기

# uncomment this if you want your log files compressed
#compress

→ 압축할지

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d
→ 기타 설정파일 읽기



그리고 /etc/logrotate.d 폴더에는 각각 데몬명으로된 파일들을 넣어서 각 데몬별로도 로그 설정이 가능합니다.



/var/log/httpd/*log {
    missingok
    notifempty
    daily
    rotate 7
    sharedscripts
    delaycompress
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}


728x90
반응형
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
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
글 보관함