首页 > 网管 > 服务器 > 正文

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

2020-05-27 13:08:54
字体:
来源:转载
供稿:网友

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

请修改 /etc/logrotate.d/squid

/home/log/squid/access.log {weeklyrotate 5copytruncatecompressnotifemptymissingok}/home/log/squid/cache.log {weeklyrotate 5copytruncatecompressnotifemptymissingok}

/home/log/squid/store.log {weeklyrotate 5copytruncatecompressnotifemptymissingok# 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 logspostrotate/usr/sbin/squid -k rotateendscript}

首先修改squid.conf

logfile_rotate 3(保留几份日志)

修改/etc/crontab

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

(每天压缩一次)

crontab /etc/crontab (crontab生效)

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表