messages 로그 파일 로테이션 되지 않는 이유
작성자 정보
- 김마현 작성
- 작성일
컨텐츠 정보
- 2,468 조회
- 0 추천
- 목록
본문
/etc/logrotate.conf
준태님과 같습니다. 하지만 FC나 Cent쪽 서버 message 로그는 4주 후에 빈파일입니다.
syslogd 를 restart 시키면 또 4주동안 로그가 쌓이고 없어집니다.
redhat 9.0과 슬랙 10.2 서버에선 별다른 설정 없이도 로테이션이 이상없이 됩니다.
모든 서버의 logrotate.conf 파일은 동일하게 설정되어 있습니다.
===============================
아래와 같이 해결했습니다.
원인 1
/tmp 가 noexec로 마운트 되어있을때 /tmp 에서 스크립트가 실행이 되지 않아 logrotate 되지 않는다. 다음과 같이 logrotate 스크립트 파일을 수정해서 해결
vi /etc/cron.daily/logrotate
#!/bin/sh
TMPDIR=/var/tmp #임시 디렉토리를 /tmp가 아닌 /var/tmp로 한다.
export TMPDIR
/usr/sbin/logrotate /etc/logrotate.conf
TMPDIR=/tmp #/tmp로 원복
export TMPDIR
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0
원인 2
/tmp 디렉토리가 noexec로 마운트 되어있고 /var/tmp 디렉토리 또한 /tmp로 링크가 걸려있을 경우. 다음과 같이 logrotate 스크립트 파일을 수정해서 해결
vi /etc/cron.daily/logrotate
#!/bin/sh
/usr/sbin/logrotate -f etc/logrotate.conf
service syslog stop
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
service syslog start
exit 0
관련자료
-
이전
-
다음