There is currently no command that returns the amount of idle time a connection has experienced. I will look into adding this to the IP::stats command.
The IP::stats command currently has the following options:
IP::stats pkts in - returns number of packets received
IP::stats pkts out - returns number of packets sent
IP::stats pkts - returns a Tcl list of packets in and packets out
IP::stats bytes in - returns number of bytes received
IP::stats bytes out - returns number of bytes sent
IP::stats bytes - returns a Tcl lost of bytes in and bytes out
IP::stats age - returns the age of the connection in seconds
(number of seconds since 3-way handshake completed).
The CLIENT_CLOSED event can be used to check the above stats when the connection is closed.
You could therefore attempt to synthesize the idle time like so:
when CLIENT_ACCEPTED {
set prev_age 0
}
when HTTP_REQUEST {
set prev_age [IP::stats age]
}
when HTTP_RESPONSE {
set prev_age [IP::stats age]
}
when CLIENT_CLOSED {
if { [expr [IP::stats age] - $prev_age] > [IP::idle_timeout] } {
log "Client: [IP::remote_addr]:[TCP::remote_port] timed out"
}
}
I have created a CR to add the following additional option to the IP::stat command:
IP::stats idle - return the number of seconds the connection has been idle.