On 04/04/2016 08:52 AM, Giray Simsek wrote: > Hi, > > Can Squid send the response time information to icap by passing a header > and a value pair to icap? Yes, Squid can do that via adaptation_meta, but true "response time" may not be the information you actually want. http://www.squid-cache.org/Doc/config/adaptation_meta/ > I am trying to get the duration for the http responses within the icap > module. That is, the time it takes to get the response from the external > web server after the initial http get request is sent. > > I am hoping there is a way to pass this information from squid to c-icap. > > I see that it is possible to log this information in squid using the > format code: > > tr Response time (milliseconds) You might be assuming (incorrectly) that the ICAP transaction starts when the HTTP transaction with the origin server ends. In reality, the two transactions may overlap. They usually do overlap for large responses. Thus, the response time is often not yet known at the ICAP transaction start time. Furthermore, %tr includes Squid-to-client delivery delays so it is especially inappropriate at pre-cache RESPMOD time. Use %<pt or %<tt to solve that part of the problem: > [http::]<pt Peer response time in milliseconds. The timer starts > when the last request byte is sent to the next hop > and stops when the last response byte is received. > [http::]<tt Total [peering] time in milliseconds. The timer > starts with the first connect request (or write I/O) > sent to the first selected peer. The timer stops > with the last I/O with the last peer. I have not checked whether %tr or %<tt logs "response time so far" if used for yet-unfinished transactions. If it does, then you may use it (but you would be relying on undocumented/not-guaranteed behavior!). You might be better off with using a combination of %ts.%03tu and %tS (instead of %<tt). The difference between %ts.%03tu and %tS values may be a better approximation for what you want: > tS Approximate master transaction start time in > <full seconds since epoch>.<fractional seconds> format. > Currently, Squid considers the master transaction > started when a complete HTTP request header initiating > the transaction is received from the client. This is > the same value that Squid uses to calculate transaction > response time when logging %tr to access.log. Currently, > Squid uses millisecond resolution for %tS values, > similar to the default access.log "current time" field > (%ts.%03tu). Ideally, you need a new logformat codes with Squid-to-origin request start time (to pair with the already supported %<pt and %<tt). Please consider adding those codes to Squid: http://wiki.squid-cache.org/SquidFaq/AboutSquid#How_to_add_a_new_Squid_feature.2C_enhance.2C_of_fix_something.3F HTH, Alex. _______________________________________________ squid-users mailing list squid-users@xxxxxxxxxxxxxxxxxxxxx http://lists.squid-cache.org/listinfo/squid-users