Rusty_Hale_8009
Jan 25, 2007Nimbostratus
I want to log the value in the array for total connections.
I have this iRule:
when RULE_INIT {
array set ::active_clients { }
}
when CLIENT_ACCEPTED {
set client_ip [IP::remote_addr]
set conn_threshold 10
if { [info exists ::active_clients($client_ip)] } {
if {$::active_clients($client_ip) > $conn_threshold } {
log local0.info "$client_ip exceeded $conn_threshold using VS [IP::local_addr]"
return
} else {
incr ::active_clients($client_ip)
}
} else {
set ::active_clients($client_ip) 1
}
}
when CLIENT_CLOSED {
if { [info exists ::active_clients($client_ip)] } {
incr ::active_clients($client_ip) -1
if { $::active_clients($client_ip) <= 0 } {
unset ::active_clients($client_ip)
}
}
}
and it works great and produces the following information in the LTM log:Jan 25 13:46:41 tmm tmm[1227]: Rule Connection_Limit_Log : 12.111.69.130 exceeded 10 using VS 10.160.225.60
Jan 25 13:46:41 tmm tmm[1227]: Rule Connection_Limit_Log : 12.111.69.130 exceeded 10 using VS 10.160.225.60
I want to take the value out of the array so that I can see the total connections by source IP in the log. Can someone please help me with that?