IT Tools
Squid Proxy 기본 설정(log, lotate)
떠도리c
2024. 8. 29. 21:59
반응형
Log 설정
squid proxy 동작 시 발생하는 access.log의 날짜 포맷을 사용자가 보기 좋도록 설정이 필요함
squid.conf 설정 편집
vi /etc/squid/squid.conf
아래 logformat 설정 추가 후 저장
logformat customformat %{%Y/%m/%d %H:%M:%S}tl %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<a %mt
access_log /var/log/squid/access.log customformat
상세 정보 : http://www.squid-cache.org/Doc/config/logformat/
squid : logformat configuration directive
Usage: logformat Defines an access log format. The is a string with embedded % format codes % format codes all follow the same basic structure where all components but the formatcode are optional and usually unnecessary, especially when dealing with common
www.squid-cache.org
Logrotate 설정
logrotate 패키지가 설치되어 있어야 함
/etc/logrotate.d/squid 편집
vi /etc/logrotate.d/squid
아래 내용 추가
/var/log/squid/access.log {
daily # daily = 일 단위 로그 저장 ( daily = 일, weekly = 주, monthly = 월 설정)
rotate 90 # rotate 90 = 90세대분 저장 ( 90일치 저장과 같은 의미)
compress
notifempty
missingok
nocreate
sharedscripts
postrotate
# Asks squid to reopen its logs. (logfile_rotate 0 is set in squid.conf)
# errors redirected to make it silent if squid is not running
/usr/sbin/squid -k rotate 2>/dev/null
# Wait a little to allow Squid to catch up before the logs is compressed
sleep 1
endscript
}
/var/log/squid/cache.log {
daily
rotate 90
copytruncate
compress
notifempty
missingok
}
반응형