免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5254 | 回复: 7
打印 上一主题 下一主题

[proxy] squid 做反向代理 access.log日志大于2G 会死掉 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-10-04 21:48 |只看该作者 |倒序浏览
今天squid突然不能工作了
日志显示如下
2007/10/04 21:29:04| storeDirWriteCleanLogs: Starting...
2007/10/04 21:29:04| WARNING: Closing open FD   42
2007/10/04 21:29:04|   Finished.  Wrote 56477 entries.
2007/10/04 21:29:04|   Took 0.1 seconds (596844.4 entries/sec).
FATAL: logfileWrite: /usr/local/squid/var/logs/access.log: (0) Success

Squid Cache (Version 2.6.STABLE16): Terminated abnormally.
CPU Usage: 29248.790 seconds = 4517.140 user + 24731.650 sys
Maximum Resident Size: 0 KB
Page faults with physical i/o: 221599
Memory usage for squid via mallinfo():
        total space in arena:  437352 KB
        Ordinary blocks:       435082 KB   9457 blks
        Small blocks:               0 KB      0 blks
        Holding blocks:         16936 KB     11 blks
        Free Small blocks:          0 KB
        Free Ordinary blocks:    2269 KB
        Total in use:          452018 KB 100%
        Total free:              2269 KB 0%
看了一下日志
access.log大于2G

[ 本帖最后由 cifan 于 2007-10-4 21:56 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2007-10-04 21:49 |只看该作者

一下是配置文件,squid做反向代理

http_port 222.18.63.37:80 vhost vport

#防止天涯盗链,转嫁给百度
acl tianya referer_regex -i tianya
http_access deny tianya
deny_info tianya
#阻止baidu蜘蛛
acl baidu req_header User-Agent Baiduspider
http_access deny baidu
#限制同一IP客户端的最大连接数
acl OverConnLimit maxconn 128
http_access deny OverConnLimit

#防止被人利用为HTTP代理,设置允许访问的IP地址
acl myip dst 222.18.63.37
http_access deny !myip

#允许本地管理
acl Manager proto cache_object
acl Localhost src 127.0.0.1 222.18.63.37
http_access allow Manager Localhost
cachemgr_passwd 53034338 all
http_access deny Manager

#仅仅允许80端口的代理
acl all src 0.0.0.0/0.0.0.0
acl Safe_ports port 80 # http
http_access deny !Safe_ports
http_access allow all

#Squid信息设置
visible_hostname happy.swjtu.edu.cn
cache_mgr  cifan.h@gmail.com

#基本设置
cache_effective_user squid
cache_effective_group squid
tcp_recv_bufsize 65535 bytes

#2.6的反向代理加速配置
cache_peer 127.0.0.1 parent 80 0 no-query originserver

#错误文档
error_directory /usr/local/squid/share/errors/Simplify_Chinese

#单台使用,不使用该功能
icp_port 0

hierarchy_stoplist cgi-bin ?

acl QUERY urlpath_regex cgi-bin \? .php .cgi .avi .wmv .rm .ram .mpg .mpeg .zip .exe
cache deny QUERY

acl apache rep_header Server ^Apache
broken_vary_encoding allow apache


refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern .               0       20%     4320

cache_store_log none
pid_filename /usr/local/squid/var/logs/squid.pid
emulate_httpd_log on
logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh
cache_log /usr/local/squid/var/logs/cache.log
access_log /usr/local/squid/var/logs/access.log combined
coredump_dir /usr/local/squid/var/cache
cache_dir ufs /usr/local/squid/var/cache 10000 16 256

dns_children 32
hosts_file /etc/hosts

cache_mem 400 MB
cache_swap_low 90
cache_swap_high 95
maximum_object_size 32768 KB
maximum_object_size_in_memory 4096 KB
emulate_httpd_log on


#防止盗链
acl picurl url_regex -i \.bmp$ \.png$ \.jpg$ \.gif$ \.jpeg$
acl mystie1 referer_regex -i happy.swjtu.edu.cn
http_access allow mystie1 picurl
acl nullref referer_regex -i ^$
http_access allow nullref
acl hasref referer_regex -i .+
http_access deny hasref picurl

论坛徽章:
0
3 [报告]
发表于 2007-10-04 21:57 |只看该作者
我想说的是 是不是因为我打开了 apahce日志格式
emulate_httpd_log on
才会这样?

论坛徽章:
0
4 [报告]
发表于 2007-10-08 12:00 |只看该作者
原因不就是大于2G么?

论坛徽章:
0
5 [报告]
发表于 2007-10-09 09:46 |只看该作者
对于2.6的squid在编译的时候请使用
./configure --with-large-files 即可解决日志文件超过2G的问题
--with-large-files      Enable support for large files (logs etc)
请仔细看看 configure 的help

论坛徽章:
0
6 [报告]
发表于 2007-10-17 21:32 |只看该作者
日记一周做循环呀

论坛徽章:
0
7 [报告]
发表于 2007-12-07 10:17 |只看该作者
是你的磁盘没空间了吧

论坛徽章:
0
8 [报告]
发表于 2007-12-29 23:18 |只看该作者
原帖由 ljh1405 于 2007-10-9 09:46 发表
对于2.6的squid在编译的时候请使用
./configure --with-large-files 即可解决日志文件超过2G的问题
--with-large-files      Enable support for large files (logs etc)
请仔细看看 configure 的help

是的。我以前也是没有加这个进去,后来找了好多资料,其实原来就是这个参数就搞定
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP