Forum Discussion
Ron_130795
Nimbostratus
Jul 18, 2014iRule Assistance for Logging client to VIP connections for a specific VIP.
I currently have my F5 sending logs to a syslog server. However, I would like to create an iRule to log the number of connections on a specific VIP called prod.invest. I would like to get the log t...
Stefan_Klotz
Cumulonimbus
Jul 23, 2014Hi 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 🙂
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects