Forum Discussion
dragonflymr
Dec 14, 2015Cirrostratus
Append to list stored in table key
Hi,
First of all I wonder if this is good idea to store list in sub/table key - considering performance nad memory consummatum. Let's say it could be list containing no more that 10 IPs.
Second I...
Stanislas_Piro2
Dec 14, 2015Cumulonimbus
Yes, you store for each session all IP addresses. but you won't be able to list all sessions stored. you may know the session ID to read list of IPs.
The best solution to keep informations readable and manageable is:
- create one subtable for each session
- create one key per IP address with value containing hit count
- force keys timeout (even if you force timeout to 1 week)
- create one subtable sessions
- one key per session
the irule can be:
when HTTP_REQUEST {
set s_id [HTTP::cookie value $my_cookie]
New session ID
if { [table lookup -subtable $session $s_id] eq "" } {
table add -subtable $session $s_id 1 $timeout
table add -subtable $s_id [IP::client_addr] 1 $timeout
Existing session ID / New IP
} elseif { [table lookup -subtable $s_id [IP::client_addr]] eq "" } {
table add -subtable $s_id [IP::client_addr] 1 $timeout
Existing session ID Existing IP
} else { table incr -subtable $s_id [IP::client_addr] $timeout}
}
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