Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What if the squid log is too large?

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to deal with the squid log is too large, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Squid is compressed once every 5 days by default, which is set in / etc/logrotate.d/squid. If you change the location of the log,

Please modify / 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

}

Modify squid.conf first

Logfile_rotate 3 (keep several logs)

Modify / etc/crontab

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

(compress once a day)

Crontab / etc/crontab (crontab effective)

Squid is compressed once every 5 days by default, which is set in / etc/logrotate.d/squid. If you change the location of the log,

Please modify / 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

}

Modify squid.conf first

Logfile_rotate 3 (keep several logs)

Modify / etc/crontab

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

(compress once a day)

Crontab / etc/crontab (crontab effective)

After SQUID authentication is configured, the log files of SQUID grow explosively, mainly access.log and cache.log, so in order to clean up the log files in a timely manner, use the following methods:

SQUID provides a log split command, squid-k rotate, which allows you to split log files into access.log.0

Access.log.1. Cache.log.0 cache.log.1. This can be done by calling corntab

Command to regularly split the log files, and then cooperate with the rm command to regularly delete these log files.

50 7 * / usr/local/squid2.7/sbin/squid-k rotate # split log files at 7:50 every day

00 8 * rm-f / usr/local/squid2.7/var/logs/access.log.*

00 8 * rm-f / usr/local/squid2.7/var/logs/store.log.*

# Delete split log files at 8:00 every day

Thank you for reading this article carefully. I hope the article "how to deal with the squid log is too large" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report