技術(shù)員聯(lián)盟提供win764位系統(tǒng)下載,win10,win7,xp,裝機(jī)純凈版,64位旗艦版,綠色軟件,免費(fèi)軟件下載基地!

當(dāng)前位置:主頁(yè) > 教程 > 服務(wù)器類 >

squid日志文件太大,怎樣處理?

來(lái)源:技術(shù)員聯(lián)盟┆發(fā)布時(shí)間:2018-05-14 18:23┆點(diǎn)擊:

squid日志文件太大,怎樣處理?

2015-03-023lian8 的分享   加三聯(lián)MM小編微信好友:sanlian2018

Squid 默認(rèn)的5天會(huì)壓縮一次, 在 /etc/logrotate.d/squid中有設(shè)置。如果你修改了日志的位置,

請(qǐng)修改 /etc/logrotate.d/squid

/home/log/squid/access.log {
weekly
rotate 5
copytruncate
compress
notifempty
missingok
}
/home/log/squid/cache.log {
weekly
rotate 5
copytruncate
compress
notifempty
missingok
}

/home/log/squid/store.log {
weekly
rotate 5
copytruncate
compress
notifempty
missingok
# This script asks squid to rotate its logs on its own.
# Restarting squid is a long process and it is not worth
# doing it just to rotate logs
postrotate
/usr/sbin/squid -k rotate
endscript
}


首先修改squid.conf

logfile_rotate 3(保留幾份日志)

修改/etc/crontab

0 0 * * * squid /home/squid/sbin/squid -k rotate

(每天壓縮一次)

crontab /etc/crontab (crontab生效)