Forum Discussion
Subtable Value
Hi All,
I have a working iRule that throttles http requests which is working a 100%.
I would like to go one step further and add logic that will allow me to log the when the throttle is enabled/disabled. However to no avail, I'm unable to get it to work.
If I lookup a value from a key that does't exist, does that return null or an empty string? I can't get it to enter the conditional that logs "Enabled"
if { [table keys -subtable "reqs" -count] > $static::max_hits_per_window } {
log local0. "test: [table lookup -subtable "throt_active" "active"]"
The above prints...
: test:
if { [table lookup -subtable "throt_active" "active"] != "" } {
log local0. "Throttle enabled: [STATS::get stats count_throt]"
table add -subtable "throt_active" "active" "true"
}
STATS::incr stats count_throt
HTTP::respond 200
}
else {
set id [table incr "ids"]
table set -subtable "reqs" $id "" $static::time_window $static::time_window
if { [table lookup -subtable "throt_active" "active"] equals "true" } {
log local0. "Throttle disabled: [STATS::get stats count_throt]"
table add -subtable "throt_active" "active" "false"
}
}
Thanks,
Drew
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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