Forum Discussion
Chris_Miller
Altostratus
Jul 06, 2010Heatmap iRule Errors
I've implemented this - http://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/1084382/Heatmaps-iRules-Style-Part-1.aspxComments and am getting a few errors.
Here's the rule, slightly modified for my environment.
when HTTP_REQUEST {
if { [HTTP::header exists "True-Client-IP"] }
{ set user_ip2 [HTTP::header True-Client-IP] }
else { set user_ip2 [IP::client_addr] }
if {[HTTP::uri] starts_with "/heatmap" and [matchclass $user_ip2 equals $::whitelist]} {
set chld ""
set chd ""
foreach state [table keys -subtable states] {
append chld $state
append chd "[table lookup -subtable states $state],"
}
set chd [string trimright $chd ","]
HTML REMOVED SO DC DOESN'T PUT UP PIC
log local0. "heatmap accessed by $user_ip2"
} elseif {[HTTP::uri] starts_with "/resetmap" and [matchclass $user_ip2 equals $::whitelist]} {
foreach state [table keys -subtable states] {
table delete -subtable states $state
}
log local0. "heatmap reset by $user_ip2"
} else {
set loc [whereis $user_ip2 abbrev]
log local0. "location is $loc"
}
if {[table incr -subtable states -mustexist $loc] eq ""} {
table set -subtable states $loc 1 indefinite indefinite
}
}
This produces the following errors in logs:
TCL error: rule_heatmap - Illegal value (line 24) invoked from within "table incr -subtable states -mustexist $loc"
- The_Bhattman
Nimbostratus
Hi Chris, I am curious to see what value you have for $loc. Have you tried outputting the value in debug? Bhattman - Chris_Miller
Altostratus
Posted By Bhattman on 07/06/2010 09:26 AM Hi Chris, I am curious to see what value you have for $loc. Have you tried outputting the value in debug? Bhattman Here's some pretty typical behavior:Jul 6 11:38:36 local/tmm info tmm[12357]: Rule rule_heatmap : location is Jul 6 11:38:36 local/tmm info tmm[12357]: Rule rule_heatmap : location is Jul 6 11:38:36 local/tmm info tmm[12357]: Rule rule_heatmap : location is Jul 6 11:38:38 local/tmm info tmm[12357]: Rule rule_heatmap : location is IL Jul 6 11:38:39 local/tmm info tmm[12357]: Rule rule_heatmap : location is IL Jul 6 11:38:39 local/tmm info tmm[12357]: Rule rule_heatmap : location is Jul 6 11:38:39 local/tmm info tmm[12357]: Rule rule_heatmap : location is Jul 6 11:38:39 local/tmm info tmm[12357]: 01220001:6: Resuming log processing at this invocation; held 4 messages. Jul 6 11:38:39 local/tmm err tmm[12357]: 01220001:3: TCL error: rule_heatmap - Illegal value (line 24) invoked from within "table incr -subtable states -mustexist $loc" Jul 6 11:38:39 local/tmm err tmm[12357]: 01220001:3: TCL error: rule_heatmap - Illegal value (line 24) invoked from within "table incr -subtable states -mustexist $loc" Jul 6 11:38:39 local/tmm info tmm[12357]: Rule rule_heatmap : location is Jul 6 11:38:39 local/tmm err tmm[12357]: 01220001:3: TCL error: rule_heatmap - Illegal value (line 24) invoked from within "table incr -subtable states -mustexist $loc" Jul 6 11:38:39 local/tmm info tmm[12357]: Rule rule_heatmap : location is Jul 6 11:38:39 local/tmm err tmm[12357]: 01220001:3: TCL error: rule_heatmap - Illegal value (line 24) invoked from within "table incr -subtable states -mustexist $loc" Jul 6 11:38:39 local/tmm info tmm[12357]: Rule rule_heatmap : location is Jul 6 11:38:39 local/tmm err tmm[12357]: 01220001:3: TCL error: rule_heatmap - Illegal value (line 24) invoked from within "table incr -subtable states -mustexist $loc" Jul 6 11:38:39 local/tmm info tmm[12357]: Rule rule_heatmap : location is Jul 6 11:38:39 local/tmm info tmm[12357]: 01220001:6: Per-invocation log rate exceeded; throttling. Jul 6 11:38:39 local/tmm info tmm[12357]: Rule rule_heatmap : location is Jul 6 11:38:39 local/tmm info tmm[12357]: Rule rule_heatmap : location is Jul 6 11:38:39 local/tmm info tmm[12357]: Rule rule_heatmap : location is Jul 6 11:38:40 local/tmm info tmm[12357]: Rule rule_heatmap : location is IL Jul 6 11:38:42 local/tmm info tmm[12357]: Rule rule_heatmap : location is IL Jul 6 11:38:43 local/tmm info tmm[12357]: Rule rule_heatmap : location is IL Jul 6 11:38:44 local/tmm info tmm[12357]: Rule rule_heatmap : location is IL Jul 6 11:38:46 local/tmm info tmm[12357]: Rule rule_heatmap : location is IL Jul 6 11:44:00 :TCL error: rule_heatmap - can't read "loc": no such variable while executing "table incr -subtable states -mustexist $loc"
- The_Bhattman
Nimbostratus
Hi Chris, - Chris_Miller
Altostratus
Posted By Bhattman on 07/06/2010 11:36 AM - hoolio
Cirrostratus
Hi Chris,when HTTP_REQUEST { if { [HTTP::header exists "True-Client-IP"] }{ set user_ip [HTTP::header True-Client-IP] set token "header" } else { set user_ip [IP::client_addr] set token "clientip" } if {[HTTP::uri] starts_with "/heatmap_$token" and [matchclass $user_ip equals whitelist]} { set chld "" set chd "" foreach state [table keys -subtable states_$token] { append chld $state append chd "[table lookup -subtable states_$token $state]," } set chd [string trimright $chd ","] HTML REMOVED SO DC DOESN'T PUT UP PIC log local0. "heatmap accessed by $user_ip" } elseif {[HTTP::uri] starts_with "/resetmap_$token" and [matchclass $user_ip equals whitelist]} { foreach state [table keys -subtable states_$token] { table delete -subtable states $state_$token } log local0. "heatmap reset by $user_ip" } else { set loc [whereis $user_ip abbrev] log local0. "location is $loc" } if {[table incr -subtable states_$token -mustexist $loc] eq ""} { table set -subtable states_$token $loc 1 indefinite indefinite } }
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