<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p>Hi Alex,</p>
<p><br>
</p>
<p>Many thanks for your reply and sorry for the <span>misleading. <span>In fact I just want to log the number of encrypted bytes received from the HTTPS client, not the decrypted HTTPS body sizes. Do you know how to do this?</span></span></p>
<p><span><span><br>
</span></span></p>
<p><span><span>I also build squid <span>3.5.23 with default parameter, and seems squid log still ignore the
<span style="font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 16px;">
encrypted bytes(except "CONNECT" header)</span> that the client send to squid server.</span></span></span></p>
<p><span><span><span><br>
</span></span></span></p>
<p><span><span><span>Below is two Get and Post commands and you can see there is no difference with their total size(%st 3520) in the logs:</span></span></span></p>
<span style="font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 16px;">curl --proxy
<span style="font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 16px;">
48.96.17.25:3128</span>  </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 16px;"><a href="https://showip.net" class="OWAAutoLink" id="LPlnk970132" previewremoved="true">https://showip.net</a></span>
<div><span style="font-size: 12pt;">curl <span style="font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 16px;">
--proxy </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 16px;">48.96.17.25:3128 </span>-d'test'
</span><span style="font-size: 12pt;">https://showip.net</span><br>
</div>
<div><br>
<div><span style="font-size: 12pt;">
<div>1482292236.816   1700 <span style="font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 16px;">
48.96.17.25</span> TCP_TUNNEL/200 <span style="color: rgb(255, 0, 0);">3408<b> 112 3520
</b>0 112</span> CONNECT showip.net:443 - HIER_DIRECT/showip.net:23.253.100.206 -</div>
<div>1482292258.735   1234 <span style="font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 16px;">
48.96.17.25</span> TCP_TUNNEL/200 <span style="color: rgb(255, 0, 0);">3408<b> 112 3520
</b>0 112</span> CONNECT showip.net:443 - HIER_DIRECT/showip.net:23.253.100.206 -</div>
</span></div>
<div>
<div></div>
<br>
</div>
<div>logformat in squid.conf is:</div>
<span><span>logformat squid %ts.%03tu %6tr %>a %Ss/%03Hs <span style="color: rgb(255, 0, 0);">
%<st<b> %>st %st </b>%<sh %>sh</span> %rm %ru %un %Sh/%<A:%<a %mt</span><b></b></span><br>
<br>
For Https, %>st is <span style="font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 16px;">
supposed</span> to be "<span>Total bytes received from client" and %st is supposed to be "<span style="font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 16px;">Total
 bytes received from client and sent to client</span>", right? But why they have no change while the client send more data to squid server? Is this a bug?</span></div>
<div><br>
</div>
<div><span></span>Thanks for all your help!</div>
<div><br>
</div>
<div>Regards,</div>
<div>Edwin<br>
<br>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt">On 20 December 2016 at 16:38<b>,</b> Alex Rousskov <rousskov@measurement-factory.com> wrote:<br>
</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">> I want to calculate all bytes when a request is sent to squid,<br>
<br>
According to squid.conf.documented, you can use the following logformat<br>
%codes to get unencrypted HTTP request sizes:<br>
<br>
<br>
> including:<br>
<br>
>  1. the header length that client will send to squid<br>
<br>
[<a href="http::">http::</a>]>sh     Size of request headers received from client<br>
<br>
<br>
>  2. the post content length that send to squid<br>
<br>
[<a href="http::">http::</a>]>st     Total size of request received from client.<br>
<br>
minus<br>
<br>
[<a href="http::">http::</a>]>sh     Size of request headers received from client<br>
<br>
<br>
>  3. the response length squid will reply to client<br>
<br>
<br>
[<a href="http::">http::</a>]<st     Total size of reply sent to client (after adaptation)<br>
<br>
minus<br>
<br>
[<a href="http::">http::</a>]<sh     Size of reply headers sent to client (after adaptation)<br>
<br>
<br>
Please note that you need Squid v3.5.22 or later for many size-related<br>
logformat %codes to work reasonably well in some environments. There<br>
were many size logging bugs in earlier versions!<br>
<br>
If some of these %codes do not work in your tests with the latest Squid,<br>
please consider filing a but report with an isolated test case<br>
illustrating the problem.<br>
<br>
<br>
> I don't need to know the request content, just want to know how many<br>
> bytes the client totally send including the post and https bytes, is it<br>
> possible to do this?<br>
<br>
The only way to measure the size of encrypted HTTP message parts is to<br>
decrypt that message. Thus, if you want to log HTTPS POST body sizes (as<br>
opposed to just the number of encrypted bytes received from the HTTPS<br>
client), then you have to tell Squid to decrypt that traffic. In most<br>
cases, decryption is not worth the associated headaches if you just want<br>
to log sizes.<br>
<br>
<br>
HTH,<br>
<br>
Alex.<br>
<br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>