«   2021/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  
04-16 19:03
Notice
Today
249
Total
1,418,552
관리 메뉴

변군이글루

[Apache] Apache 로그 logrotate(로테이드) 설정 본문

* 리눅스

[Apache] Apache 로그 logrotate(로테이드) 설정

변군 변군이글루 2021. 1. 7. 13:48

Apache 로그 logrotate(로테이드) 설정

apache logrotate 파일 편집

vim /etc/logrotate.d/apache

$ cat /etc/logrotate.d/apache
/logs/access/*-access-*.log
/logs/error/*-error-*.log
{
	daily
	rotate 7
	notifempty
	missingok
	compress
	delaycompress
	sharedscripts
	postrotate
		/bin/kill -HUP `cat /usr/local/apache/logs/httpd.pid 2>/dev/null` 2> /dev/null || true
	endscript
}

logrotate 실행

/sbin/logrotate -f /etc/logrotate.d/apache

$ /sbin/logrotate -f /etc/logrotate.d/apache

$ ls -l /logs/access
www.sangchul.kr-access-ssl-20210107.log.1

logrotate 실행(상세 내용 출력)

/sbin/logrotate -v /etc/logrotate.d/apache

$ /sbin/logrotate -v /etc/logrotate.d/apache
reading config file /etc/logrotate.d/apache
Allocating hash table for state file, size 15360 B

Handling 1 logs

rotating pattern: /logs/access/*-access-*.log
/logs/error/*-error-*.log
 after 1 days (7 rotations)
empty log files are not rotated, old logs are removed
considering log /logs/access/test.sangchul.kr-access-20210107.log
  log does not need rotating (log has been already rotated)considering log /logs/access/www.sangchul.kr-access-ssl-20210107.log
  log does not need rotating (log has been already rotated)considering log /logs/error/*-error-*.log
  log /logs/error/*-error-*.log does not exist -- skipping
not running postrotate script, since no logs were rotated

 

 

0 Comments
댓글쓰기 폼