Forum Discussion
Kevin_Davies
Oct 19, 2017MVP
Alternatively you can add a one line iRule.
when CLIENT_ACCEPTED {
log local0. "Connection from [IP::client_addr]"
}
This will log an entry for every connection. If you have many thousands of connections then you can use the rule below to store connection information in session tables which can be retrieved later with a reporting iRule.
when CLIENT_ACCEPTED {
table incr client-[IP::client_addr]
table timeout client-[IP::client_addr] 3600
table add -subtable client-tracking client-[IP::client_addr] 3600
}
Client connection information is stored for up to an hour, adjust this with the 3600 seconds above. If we don't see that client come back in an hour then it is automatically expired from the session table.
The reporting iRule below gives you the output from the collected stats above. It can be attached to any virtual server on the same F5. You trigger it with and it will display a page of collected connection information.
when HTTP_REQUEST {
if {[HTTP::uri] ne "/connections" } { return }
set response "Connections\r\n"
foreach key [table keys -subtable client-tracking] {
append response "$key = [table lookup $key]\r\n"
}
HTTP::respond 200 content $response Content-Type "text/plain" Connection Close
event disable
}