Forum Discussion
ahmad_2312
Jul 10, 2011Nimbostratus
using the following code, i was able to get the response time based on POST and GET Parameters, however i am still getting some TCL Error in logs
TCL error: Response_Time_2 - Illegal argument (line 9) invoked from within "HTTP::collect [HTTP::header Content-Length]" ("POST" arm line 3) invoked from within "switch [HTTP::method] { "GET"
when HTTP_REQUEST {
set http_request_time [clock clicks -milliseconds]
set theurl [HTTP::uri]
set theip [IP::client_addr]
set wmethod [HTTP::method]
set contype [HTTP::header Content-Type]
set POSTQuery ""
set GETQuery ""
switch [HTTP::method] {
"GET" {
Inspect Query String
set GETQuery [string tolower [URI::query "?&[HTTP::query]" hidActionName]]
}
"POST" {
if { [HTTP::header Content-Type] eq "application/x-www-form-urlencoded" } {
HTTP::collect [HTTP::header Content-Length]
}
}
}
}
when HTTP_REQUEST_DATA {
set POSTQuery [string tolower [URI::query "?[HTTP::payload]" hidActionName]]
}
when HTTP_RESPONSE {
set http_response_time [ clock clicks -milliseconds ]
log 10.0.10.16:514 local0. "CEF:0|XX|XX|10.2|200|Response Time|2|src=$theip request=$theurl cn1=[expr $http_response_time - $http_request_time] cs1=$wmethod cs2=$contype cs4=$POSTQuery cs6=$GETQuery"
}