大网数据广告活动
服务器运维问答

Where is the response size in Squid's access.log?

· 52CE 我爱测

I need to make a program that logs bandwidth usage per-user of a squid proxy. In my access.log I see output such as... 1481377143.042 0 104.123.25.183 TCP_DENIED/407 3829 CONNECT scontent.xx.fbcdn.net:443 - HIER_NONE/- text/html …

问题原文

原帖链接 · xendi · CC BY-SA 3.0

I need to make a program that logs bandwidth usage per-user of a squid proxy. In my access.log I see output such as...

1481377143.042      0 104.123.25.183 TCP_DENIED/407 3829 CONNECT scontent.xx.fbcdn.net:443 - HIER_NONE/- text/html
1481377143.403      0 104.123.25.183 TCP_DENIED/407 3793 CONNECT cx.atdmt.com:443 - HIER_NONE/- text/html
1481377277.865 134623 104.123.25.183 TCP_MISS/200 4118 CONNECT scontent.xx.fbcdn.net:443 star7 HIER_DIRECT/2a03:2880:f022:b:face:b00c:0:3 -
1481377277.868 134626 104.123.25.183 TCP_MISS/200 4116 CONNECT scontent.xx.fbcdn.net:443 star7 HIER_DIRECT/2a03:2880:f022:b:face:b00c:0:3 -

I believe the response size in bytes is supposed to be in there but which entry is it? I realize header size isn't logged so the accuracy won't be perfect but it should be accurate enough. I don't know any better way to keep track of squid user bandwidth usage so this will have to do but I need to know which is the size entry.

已采纳解答

原帖链接 · Brian · CC BY-SA 3.0

The native log format is:

"%9d.%03d %6d %s %s/%03d %d %s %s %s %s%s/%s %s"

With the 5th part (%d after %s/%03d) being:

bytes The size is the amount of data delivered to the client. Mind that this does not constitute the net object size, as headers are also counted. Also, failed requests may deliver an error page, the size of which is also logged here.

ref: http://wiki.squid-cache.org/Features/LogFormat

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-12-10)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。