Forum Discussion
Anthony
Nimbostratus
Mar 01, 2017when CLIENT_CLOSED timing out
Hi all, I have an iRule which is used for logging the complete connection against a test environment. I run the following events:
when CLIENT_ACCEPTED when CLIENTSSL_CLIENTHELLO when CLIENTSS...
cjunior
Nacreous
Mar 01, 2017Hi,
I think you are collecting even the verbs don't have body, such GET, HEAD, etc. So, I edited that to consider only POST verb. If this is an webservice or something else, you should include another verbs to consider the collect.
This is what I would like to change:
when HTTP_REQUEST {
catch {HTTP::header remove "Accept-Encoding"}
set headers ""
set uri [HTTP::uri]
if { [HTTP::method] eq "POST" } {
if { [HTTP::header exists "Content-Length"] && [HTTP::header "Content-Length"] <= 2048 } {
set content_length [HTTP::header "Content-Length"]
} else {
set content_length 2048
}
if { $content_length > 0} {
HTTP::collect $content_length
}
}
log local0. "Client $ip | Request uri = [HTTP::method] $uri"
foreach head [HTTP::header names] {
append headers "$headers [HTTP::header values $head]"
}
if { [HTTP::header exists "X-Forwarded-For"] } {
set xff [getfield [lindex [HTTP::header values X-Forwarded-For] 0] "," 1]
}
set cookies [string map {" " ","} [lsort [HTTP::cookie names]]]
log local0. "Client $ip (XFF=$xff)| $headers"
}
when HTTP_REQUEST_DATA {
log local0. "Client $ip | Payload: [HTTP::payload]"
}
when HTTP_RESPONSE {
set resp_head ""
if { [HTTP::header exists "Content-Length"] && [HTTP::header "Content-Length"] <= 1048576 } {
set response_length [HTTP::header "Content-Length"]
} else {
set response_length 1048576
}
if { $response_length > 0 } {
HTTP::collect $response_length
}
log local0. "Client $ip | Request uri = $uri | Response status code = [HTTP::status] $response_length"
foreach head [HTTP::header names] {
append resp_head "$head=[HTTP::header values $head]"
}
log local0. "Response headers: $resp_head"
}
when HTTP_RESPONSE_DATA {
log local0. "Response payload: [HTTP::payload]"
}
Best regards.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects