Forum Discussion
Size after compression
Hi,
I use iRule for sending Logs to external component. I want to get the size of the response after the F5 compression but unfortunately i get only the size before. i use the "content_length" header, maybe i wrong? how can i get the size after the compression?
My iRule is:
when HTTP_RESPONSE {
set pname [HTTP::header "PName"] set content_length 0 if { [HTTP::header exists "Content-Length"] } { set content_length [HTTP::header "Content-Length"] } if { [HTTP::header exists "X-AspNet-Version"] } { HTTP::header remove X-AspNet-Version }
if { [HTTP::header exists "X-Powered-By"] } {
HTTP::header remove X-Powered-By
}
HSL::send $web_hsl "<187> Response: IP=$clientip Id=$clientport Proxy=$lb_server:$lb_port H=$Host M=$Method URL=\"$URL\" R=\"$Referer\" A=\"$Agent\" Status=[HTTP::status] Size=$content_length Time_ms=[expr {[clock clicks -milliseconds] - $http_request_time}] Number=$Number UserID=$UID Ver=$Ver pname=$pname" }
thank you, Tomer.
1 Reply
Hi Tomer,
you may take a look to the provided iRule posted in this topic...
https://devcentral.f5.com/questions/how-to-get-the-response-size-after-gzip-compression-49060?tag=irules
It uses the HTTP_REQUEST event to inspect the Content-Lenght before compression and the HTTP_RESPONSE_RELEASE event to inspect the Content-Lenght after compression and performs additional math to calculate the compression rate.
Note: Keep in mind, that HTTP responses with chunked HTTP content will not include a Content-Lenght header. It will be very hard to account the size for those requests... See https://en.wikipedia.org/wiki/Chunked_transfer_encoding for further information
Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
