Forum Discussion
Stefan_Klotz
Jul 23, 2014Cumulonimbus
Hi Ron,
please find below updated iRule without syntax errors (but still not functional tested) and logging to a remote syslog server.
when RULE_INIT {
set ::last_midnight [clock scan {2014-07-21 00:00:00}]
set ::connection_count 0
}
when CLIENT_ACCEPTED {
set current_time [clock seconds]
Check if the difference to last_midnight is less than 24 hours (86400 seconds)
if { [expr $current_time - $::last_midnight] < 86400 } {
incr ::connection_count
} else {
Log current connection_count value
log local0. "Number of connections for the last 24 hours: $::connection_count"
Reset the connection_count value
set ::connection_count 0
Increment last_midnight with 24 hours (86400 seconds)
set ::last_midnight [expr $::last_midnight + 86400]
}
}
Please give it a try again.
Ciao Stefan 🙂