Forum Discussion
Mike_Maher
Nimbostratus
Jun 16, 2010Trying to throttle logging
I am running the following iRule on some of my Virtuals, I had an issues where we tripped the first logging entry ( log local0. "WARNING:
Local server [LB::server addr] on
port [LB::server port] just...
Mike_Maher
Nimbostratus
Jun 16, 2010Aaron,
Thanks for the link, I had actually just found it and was working it into my rule. If you would mind, taking a look and see if I have implemented it appropriately within my rule. I have also added a status check to verify the remote node is up before sending the traffic. Still new to iRules, but finding that the resources and folks on DevCentral to be very helpful. Thanks
when RULE_INIT {
Initialize a variable to track the last time a log message was made
set ::last_log_timestamp [clock seconds]
Shortest interval (in seconds) to log a message
set ::min_log_interval 60
}
when LB_FAILED {
We still have local servers in the pool, but the server we picked timed out or reset the TCP connection
for some reason. Don't send them to the remote datacenter yet.
if { [active_members [LB::server pool]] > 0 } {
Check if the log interval has passed
if {[expr {[clock seconds] - $::last_log_timestamp}] > $min_log_interval}{
log local0. "WARNING: Local server [LB::server addr] on port [LB::server port] just refused a connection"
Update the last run timestamp
set ::last_log_timestamp [clock seconds]
LB::reselect
}
}
Checks the status of the remote data center to make sure there are servers available to send to if there is
it will reject the connection
if { [LB::status node 1.2.3.4] eq "down" } {
reject
}
else {
We have one of 2 cases:
1. All local pool servers are down by monitor
2. All local pool servers have reached their connection limits
log local0. "Connection request made to local servers, sending to remote data center because LB_FAILED"
resend the request to the following IP and port
node 1.2.3.4 80
Apply this snat to make the return traffic come back through this LTM
snat 4.3.2.1
tell the LTM to backup and retry this connection to the hard coded address and port
LB::reselect
}
}
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