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.
2 Replies
- 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,
I haven't used the after command yet. Do you have any idea if there's a significant performance hit with it? If so, it might be more efficient to log twice and parse the LTM log off the box.
Aaron
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