Windows XP Windows 7 Windows 2003 Windows Vista Windows教程綜合 Linux 系統教程
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟件教程
 Windows教程網 >> 電腦軟件教程 >> 服務器技術 >> 關於服務器 >> squid日志文件太大,怎樣處理?

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

日期:2017/2/8 10:12:14      編輯:關於服務器

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生效)

Copyright © Windows教程網 All Rights Reserved