免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3737 | 回复: 9

[proxy] squid的access.log文件大小问题 [复制链接]

论坛徽章:
0
发表于 2006-03-15 16:37 |显示全部楼层
access.log文件似乎是一周产生一个新文件,我如何改为在更短的时间内产生新文件,比如说1天。需要在哪里配置,请各位帮忙解答。

论坛徽章:
0
发表于 2006-03-18 11:44 |显示全部楼层
你定时rotate吧,这样子就不会超过两G了。。。

论坛徽章:
0
发表于 2006-03-18 13:00 |显示全部楼层
在/etc/crontab里加
0 0 * * * root /usr/local/squid/sbin/squid -k rotate
每天生成一个日志文件.

论坛徽章:
0
发表于 2006-03-19 11:07 |显示全部楼层
多谢!我已经添加,看看效果如何。

论坛徽章:
0
发表于 2006-03-20 17:49 |显示全部楼层
原帖由 ability 于 2006-3-18 13:00 发表
在/etc/crontab里加
0 0 * * * root /usr/local/squid/sbin/squid -k rotate
每天生成一个日志文件.



这个是正解

论坛徽章:
0
发表于 2006-03-21 04:47 |显示全部楼层
其實 linux 上面目前都有 logrotate 程式,而 freebsd 上面也有 newsyslog 提供 log 整理功能,請多加利用。

像是我系統 linux 的 /etc/logrotate.d/squid 配置:


  1. /var/log/squid/access.log {
  2.     weekly
  3.     rotate 5
  4.     copytruncate
  5.     compress
  6.     notifempty
  7.     missingok
  8. }
  9. /var/log/squid/cache.log {
  10.     weekly
  11.     rotate 5
  12.     copytruncate
  13.     compress
  14.     notifempty
  15.     missingok
  16. }

  17. /var/log/squid/store.log {
  18.     weekly
  19.     rotate 5
  20.     copytruncate
  21.     compress
  22.     notifempty
  23.     missingok
  24. # This script asks squid to rotate its logs on its own.
  25. # Restarting squid is a long process and it is not worth
  26. # doing it just to rotate logs
  27.     postrotate
  28.       /usr/sbin/squid -k rotate
  29.     endscript
  30. }
复制代码


==

论坛徽章:
0
发表于 2006-03-21 18:02 |显示全部楼层
我在/etc/crontab里添加了
0 0 * * * root /usr/sbin/squid -k rotate
没有效果,手动执行也没变化。
我的/etc/logrotate.d/squid配置也如6楼所说。
还请各位提点~~~

论坛徽章:
0
发表于 2006-03-22 09:04 |显示全部楼层

回复 7楼 龙飘飘 的帖子

自已做个shell脚本也可以啊.把每天的日志都切割出来.
然后放到crontab里定时执行.

论坛徽章:
0
发表于 2006-03-22 09:05 |显示全部楼层
原帖由 ability 于 2006-3-18 13:00 发表
在/etc/crontab里加
0 0 * * * root /usr/local/squid/sbin/squid -k rotate
每天生成一个日志文件.



这个是squid FAQ建意的方法.你在看看自己的配置吧.怎么会不起作用呢

论坛徽章:
0
发表于 2006-03-22 18:26 |显示全部楼层
我添加的是:
0 0 * * * root /usr/sbin/squid -k rotate
手动执行的是/usr/sbin/squid -k rotate,没有反应,:(
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP