Forum Discussion
smiley_dba_1116
Feb 29, 2016Nimbostratus
ok. I tried that, but still getting that clear data issue.
Error /linkcleardata]["/linkcleardata" { table delete -subtable $TABLE_LINK -all;
when HTTP_REQUEST {
set TABLE_LINK "LINK_TRACKING_[virtual name]";
set TABLE_FILTERS "LINK_TRACKING_FILTERS_[virtual name]";
swith -glob [string tolower [HTTP::uri]] {
"/linkadmin*" {
set count_filter "";
set data_filter "";
set msg [URI::decode [getfield [HTTP::uri] "/" 3]]
if { ($msg starts_with "f(") && ($msg ends_with ")") } {
set count_filter "";
set data_filter [string range $msg 2 end-1];
set msg "";
} elseif { ($msg starts_with "c(") && ($msg ends_with ")") } {
set count_filter [string range $msg 2 end-1];
set data_filter "";
set msg "";
}
set count [table keys -subtable $TABLE_LINK -count]
set content {URI tracking
URI Tracking
append content "$TABLE_LINK"
append content "Link Count$count"
append content {Controls
}
append content "URI Filters"
foreach key [table keys -subtable $TABLE_FILTERS] {
append content "\[\] $key
";
}
append content "";
append content {Add Filter
}
if { "" !=$msg } {
append content "Message%msg";
}
append content "";
append content ""
append content "Link Metrics";
append content "URICount";
append content {Filter Results }
append content "x]
}
append content " []
};
foreach key [table keys -subtable $TABLE_LINK] {
if { "" != $data_filter } {
if { [string match $data_filter $key] } {
set v [table lookup -subtable $TABLE_LINK $key];
append content "\[\] $key$v";
}
} elseif { "" != $count_filter } {
set v [table lookup -subtable $TABLE_LINK $key];
if { $v >= $count_filter } {
append content "\[\] $key$v";
}
} else {
set v [table lookup -subtable $TABLE_LINK $key];
append content "\[\] $key$v";
}
}
append content "";
HTTP::respond 200 Content $content;
}
"/linkcleardata" {
table delete -subtable $TABLE_LINK -all;
HTTP::redirect "http://[HTTP::host]/linkadmin/Link+Tracking+Cleared"
}
"/linkremovedata/*" {
set val [string range [HTTP::uri] [string length "linkremovedata/"] end]
if { "" != $val }{
table delete -subtable $TABLE_LINK $val;
}
HTTP::redirect "http://[HTTP::host]/linkadmin/Link+Deleted";
}
"/linkclearfilters" {
table delete -subtable $TABLE_FILTERS -all;
HTTP::redirect "http://[HTTP::host]/linkadmin/Link+Filters+Cleared"
}
"/linkaddfilter/*" {
set f [string range [HTTP::uri][string length "/linkaddfilter/"] end]
if { "" != $f}{
table add -subtable $TABLE_FILTERS $f 1 indefinite indefinite;
}
HTTP::redirect "http://[HTTP::host]/linkadmin/Filter+Added";
}
"/linkremovefilter/*" {
set val [string range [HTTP::uri][string length "linkremovefilter/"] end]
if { "" != $val }{
table delete -subtable $TABLE_FILTERS $val;
}
HTTP::redirect "http::/[HTTP::host]/linkadmin/Filter+Deleted";
}
default {
set match 1;
set c [table keys -subtable $TABLE_FILTERS -count]
if { $c != 0 } {
set match 0;
foreach key [lsort [table keys -subtable $TABLE_FILTERS]] {
set m [string match $key [HTTP::uri]];
if { 1 == $m } {
set match 1;
break;
}
}
}
}
}
}
}