Forum Discussion

Rab_101866's avatar
Rab_101866
Icon for Nimbostratus rankNimbostratus
Sep 13, 2010

Logging 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

  • 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.
  • 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