- 论坛徽章:
- 0
|
Rotating SQUID log with newsyslog
Kenny Zhao, kunfirst.blogchina.com
if you have any question, please feel free to send me a email:
kfirst@gmail.com
--------------------------------
* Introduction:
rorate squid log,and make sure its filename is automatically
renamed as a date-based pattern,such as: access20050412.log.gz
download newsyslog from http://www.eyrie.org/~eagle/software/newsyslog/
BTW: newsyslog is an official recommendation to replace rotatelog by SQUID.
* Installation:
1.Install newsyslog 1.6
- ./configure
- make
- make install
复制代码
newsyslog should be installed into /usr/local/sbin/newsyslog
2.Crate a new file: /usr/local/etc/newsyslog.conf, paste lines below:
- set squid_logpath = /usr/local/squid/var/logs
- set squid_log = /usr/local/squid/var/logs/access.log
- set date_squid_log = /usr/local/squid/var/logs/access%Y%M%D.log
- SQUID{
- restart: run /usr/local/squid/sbin/squid -k rotate
- log: SQUID squid_log squid squid 644
- archive: SQUID date_squid_log 0
- }
复制代码
3.run newsyslog in crontab,(example: run once 23:58 daily):
- 58 23 * * * /usr/local/sbin/newsyslog
复制代码 |
|