squid日志文件太大,怎样处理?

Squid默认的5天会压缩一次, 在 /etc/logrotate.d/squid中有设置。如果
强烈推介IDEA2020.2破解激活,IntelliJ IDEA 注册码,2020.2 IDEA 激活码

 

Squid 默认的5天会压缩一次, 在  /etc/logrotate.d/squid中有设置。如果你修改了日志的位置,

请修改 /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生效)

本文来源21aspnet,由javajgs_com转载发布,观点不代表Java架构师必看的立场,转载请标明来源出处:https://javajgs.com/archives/2721

发表评论