[squid-users] Help: How to calculate all bytes when communicate with client for a request

Alex Rousskov rousskov at measurement-factory.com
Tue Dec 20 16:38:46 UTC 2016

On 12/20/2016 03:56 AM, wei wrote:

> I want to calculate all bytes when a request is sent to squid,

According to squid.conf.documented, you can use the following logformat
%codes to get unencrypted HTTP request sizes:

> including:

>  1. the header length that client will send to squid

[http::]>sh     Size of request headers received from client

>  2. the post content length that send to squid

[http::]>st     Total size of request received from client.


[http::]>sh     Size of request headers received from client

>  3. the response length squid will reply to client

[http::]<st     Total size of reply sent to client (after adaptation)


[http::]<sh     Size of reply headers sent to client (after adaptation)

Please note that you need Squid v3.5.22 or later for many size-related
logformat %codes to work reasonably well in some environments. There
were many size logging bugs in earlier versions!

If some of these %codes do not work in your tests with the latest Squid,
please consider filing a but report with an isolated test case
illustrating the problem.

> I don't need to know the request content, just want to know how many
> bytes the client totally send including the post and https bytes, is it
> possible to do this?

The only way to measure the size of encrypted HTTP message parts is to
decrypt that message. Thus, if you want to log HTTPS POST body sizes (as
opposed to just the number of encrypted bytes received from the HTTPS
client), then you have to tell Squid to decrypt that traffic. In most
cases, decryption is not worth the associated headaches if you just want
to log sizes.



More information about the squid-users mailing list