Forum Discussion
Javier_95414
Apr 13, 2011Nimbostratus
how to see the active connections of a virtual server?
hi,
i want to see the connections of a virtual server. with this irules i can see all:
when LB_SELECTED { log "[IP::client_addr]:[TCP::client_port]-->[IP::local_addr]:[TCP::local_p...
Michael_Yates
Apr 13, 2011Nimbostratus
Do you just want to log the client connections or additional information?
Here is an example of a testing iRule that I have. It will log the Client Connect (IP Address and Port) and any HTTP Requests within that TCP Session. Then it will give you the timing / transaction processing time for the entire TCP Session and any HTTP Requests within it.
You could easily edit it to do whatever else you need.
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) Client [IP::client_addr]:[TCP::client_port] to [IP::local_addr]:[TCP::local_port] (Connection Open for: [expr {[clock clicks -milliseconds] - $tcp_start_time}]ms)"
}
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