Forum Discussion
John_Zammit_459
Mar 14, 2011Nimbostratus
iRule logging HTTP/SSL session times
I'm trying to get a script working to log HTTP session times script I'm running is as follows ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ wh...
Michael_Yates
Mar 14, 2011Nimbostratus
I've had to create a similar iRule to measure the entire Client Connection as well as the individual HTTP Requests made by that client in their connection.
This will log it all to the LTM Log and is based on the Client IP Address (There are several options that are disabled, so you enable/disable options to get what you want):
when CLIENT_ACCEPTED {
Get time for start of TCP Connection in milliseconds
set tcp_start_time [clock clicks -milliseconds]
Log the start of a new HTTP Request
set local0. "(TCP Connection - Start) [IP::client_addr]:[TCP::client_port] to [IP::local_addr]:[TCP::local_port]"
}
when HTTP_REQUEST {
Get time for start of HTTP Request in milliseconds
set http_request_time [clock clicks -milliseconds]
Log the start of new HTTP Request with URI
set LogString "Client [IP::client_addr]:[TCP::client_port] -> [HTTP::uri]"
Log the start of new HTTP Request without URI
set LogString "Client [IP::client_addr]:[TCP::client_port]"
log local0. "(HTTP - Request) $LogString"
}
when HTTP_RESPONSE {
Recieved the response headers from the server. Log the pool name, IP and port, status and time delta
Detailed Log Output - Client Communication - Pool Information - Status Messages - and Communication Delta
log local0. "(Response) $LogString - pool info: [LB::server] - status: [HTTP::status] (Request / Response Delta: [expr [clock clicks -milliseconds] - $http_request_time]ms)"
Response and Communication Delta
log local0. "(HTTP - Response) $LogString - (Request / Response Delta: [expr [clock clicks -milliseconds] - $http_request_time]ms)"
}
when CLIENT_CLOSED {
Log the end time of the TCP Connection
Detailed Connection Closed - Transaction can be located by using the Client IP Address and Port to Load Balancer IP Address and Port for additional matching parameters.
log local0. "(TCP Connection - Close) $LogString [IP::client_addr]:[TCP::client_port] to [IP::local_addr]:[TCP::local_port] (Connection Open for: [expr [clock clicks -milliseconds] - $tcp_start_time]ms)"
}
Hope this helps.
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