Forum Discussion

Dmitriy_Tiper's avatar
Dmitriy_Tiper
Icon for Altostratus rankAltostratus
May 27, 2016

LTM iRule to measure duration of server side TCP connection in case of OneConnect profile applied to VS

We are currently migration from ACE to F5 LTM and trying to replicate ACE functionality as much as we can.

 

One of the ACE features is logging of duration of TCP connection and number of bytes on this connection (when connection closes)

 

I am trying to replicate it with this iRule:

 

when SERVER_CONNECTED { set tcp_start_time_server [clock clicks -milliseconds]

 

when SERVER_CLOSED { HSL::send $lpAll "Closed server-side TCP connection from translated [IP::local_addr]:[TCP::local_port] to pool member [IP::server_addr]:[TCP::server_port] (bytes from server [IP::stats bytes in]/bytes to server [IP::stats bytes out]) (open for: [expr {[clock clicks -milliseconds] - $tcp_start_time_server}] ms)"

 

And it works fine if no OneConnect profile applied to the VS. However, with OneConnect, when connection re-use on the server side happens, it appears that event when SERVER_CONNECTED doesn't happen all the time, variable tcp_start_time_server doesn't exist and I get TCL error in the log:

 

TCL error: /Common/time_test - can't read "tcp_start_time_server": no such variable while executing "expr {[clock clicks -milliseconds] - $tcp_start_time_server}"

 

Is there a way to calculate server-side TCP connection duration when OneConnect is applied to a VS? It is beyond me in terms of my knowledge at the moment.