Forum Discussion
Rab_101866
Nimbostratus
Sep 13, 2010Logging HTTP requests
Hi,
I am trying to log similar info that apache does e.g. url response time etc.
I have got something working but since it only logs when you get an http response, I think I am losing data.
My irule is something like this -
when HTTP_REQUEST {
set http_request_time [clock clicks -milliseconds]
set url [HTTP::host][HTTP::uri]
set xforwardfor [HTTP::header X-Forwarded-For]
}
when HTTP_RESPONSE {
set http_response_time [ clock clicks -milliseconds ]
set nodeResp [HTTP::status]
set responseTime [expr $http_response_time - $http_request_time]
log local0.info "$url $responseTime $nodeResp $xforwardfor"
}
If there is a request and no http response can I detect this and issue the log message?
I am trying to only log one line per request
Regards,
Rab.
- JRahm
Admin
If you have 10.X plus, you could use after command in conjunction with a catch variable setting in HTTP response. If the variable isn't there, log the request. - hoolio
Cirrostratus
Hi Jason,
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