ahmad_2312
Jul 09, 2011Nimbostratus
Measuring Response time based on POST and GET Parameters
HI
I am trying to measure the response time of each transaction in our website, however due to security reasons all URLs are masked and the only way to identify the page is by using a submitted form's parameter called hidActionName, the parameter is submitted in some pages using GET method and in other in POST, i tried my best and came up with this , but it didnt work ... can you help please:
when HTTP_REQUEST {
set http_request_time [clock clicks -milliseconds]
set theurl [HTTP::uri]
set theip [IP::client_addr]
set wmethod [HTTP::method]
Only check POST requests
if { [HTTP::method] eq "POST" } {
Default amount of request payload to collect (in bytes)
set collect_length 2048
Check for a non-existent Content-Length header
if {[HTTP::header Content-Length] eq ""}{
Use default collect length of 2k for POSTs without a Content-Length header
set collect_length $collect_length
} elseif {[HTTP::header Content-Length] == 0}{
Don't try collect a payload if there isn't one
unset collect_length
} elseif {[HTTP::header Content-Length] > $collect_length}{
Use default collect length
set collect_length $collect_length
} else {
Collect the actual payload length
set collect_length [HTTP::header Content-Length]
}
If the POST Content-Length isn't 0, collect (a portion of) the payload
if {[info exists collect_length]}{
Trigger collection of the request payload
HTTP::collect $collect_length
}
}
}
when HTTP_REQUEST_DATA {
set ActionName [URI::decode [URI::query "?[HTTP::payload]" hidActionName]]
}
when HTTP_RESPONSE {
set http_response_time [ clock clicks -milliseconds ]
log 10.0.10.16:514 local0. "CEF:0|XXX|XXXX|10.2|200|Response Time|2|src=$theip request=$theurl cn1=[expr $http_response_time - $http_request_time] cs1=$wmethod cs2=$ActionName"
}