Forum Discussion
No output from persist lookup $header1
Hi all,
We have a case there we need to investigate and take decision based on persistence record.
I do a set ins_id to read header that also is used in persistent table. Persistent work and I have value in table when look in persistence table via TMSH. So it's OK. Problem is that I can´t get any value in log from "persist lookup uie" part.
set inst_id [HTTP::header value "installationId"] set pvaleu [persist lookup uie $inst_id] if {$host_debug}{log local0. "$log_prefix: installationId = $inst_id and pvaleu = $pvaleu"}
When I look in log it´s looks like this:
Dec 22 12:26:26 lbt_bgc_a1 info tmm1[28894]: Rule /Common/i-rule_d171222 : client IP:port=213.115.83.54:29873; VIP=/Common/: installationId = 48548FBCB1BB4D1780C3E7D18C3FD9C5 and pvaleu =
So I do not get any output from "set pvaleu [persist lookup uie $inst_id]" in LTM log.
Best Regards and Have a Great Christmas
//Goran
- Leonardo_Souza
Cirrocumulus
https://devcentral.f5.com/wiki/irules.persist.ashx
"persist lookup [all|node|port|pool] "all" or no specification returns a list containing the node, port and pool name. Specifying any of the other return types will return the specified item only. = | { [any virtual|service|pool] [pool ] } the latter key specification is used to access persistence entries across virtuals, services, or pools."
Try to add the virtual server or pool in the lookup command. The link has multiple examples.
- nitass
Employee
this is mine. big-ip is running 12.1.2.
// config root@(bip1a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm virtual baz ltm virtual baz { destination 10.200.155.165:80 ip-protocol tcp mask 255.255.255.255 pool foo profiles { http { } tcp { } } rules { qux } source 0.0.0.0/0 source-address-translation { type automap } translate-address enabled translate-port enabled vs-index 3 } root@(bip1a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule qux ltm rule qux { when HTTP_REQUEST { log local0. "\[HTTP::cookie SESSION\]=[HTTP::cookie SESSION]" if { [HTTP::cookie SESSION] ne "" } { log local0. "persist lookup uie [HTTP::cookie SESSION]=[persist lookup uie [HTTP::cookie SESSION]]" persist uie [HTTP::cookie SESSION] } } when HTTP_RESPONSE { log local0. "\[HTTP::cookie SESSION\]=[HTTP::cookie SESSION]" if { [HTTP::cookie SESSION] ne "" } { persist add uie [HTTP::cookie SESSION] } } } // client curl -I http://10.200.155.165 HTTP/1.1 200 OK Date: Fri, 22 Dec 2017 20:48:25 GMT Server: Apache/1.3.26 (Unix) PHP/4.1.2 mod_ssl/2.8.10 OpenSSL/0.9.6b X-Powered-By: PHP/4.1.2 Set-Cookie: SESSION=a83ccc31492529e8cd457417befb5e59; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Type: text/html curl -I http://10.200.155.165 -H "cookie: SESSION=a83ccc31492529e8cd457417befb5e59" HTTP/1.1 200 OK Date: Fri, 22 Dec 2017 20:48:41 GMT Server: Apache/1.3.26 (Unix) PHP/4.1.2 mod_ssl/2.8.10 OpenSSL/0.9.6b X-Powered-By: PHP/4.1.2 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Type: text/html // big-ip [root@bip1a:Active:In Sync] config tail -f /var/log/ltm Dec 22 21:32:01 bip1a info tmm[12155]: Rule /Common/qux : [HTTP::cookie SESSION]= Dec 22 21:32:01 bip1a info tmm[12155]: Rule /Common/qux : [HTTP::cookie SESSION]=a83ccc31492529e8cd457417befb5e59 Dec 22 21:32:17 bip1a info tmm[12155]: Rule /Common/qux : [HTTP::cookie SESSION]=a83ccc31492529e8cd457417befb5e59 Dec 22 21:32:17 bip1a info tmm[12155]: Rule /Common/qux : persist lookup uie a83ccc31492529e8cd457417befb5e59=/Common/foo 10.200.155.166 80 Dec 22 21:32:17 bip1a info tmm[12155]: Rule /Common/qux : [HTTP::cookie SESSION]=
- Goran_Blomquis1
Nimbostratus
Thanx for replay both of you.
There was some Christmas and a new year, some other assignments between, so that´s why my feedback have been delayed. I did some redesign so I did not have to use "lookup" command, did not get it to work in the event I needed it. Insted I used a Universal Persistense profile on both virtual servers. Persist profile use "Match Across Virtual Servers" and desired timeout.
Used persist add to add persistence in response header on first vip and then used persist on URI to use same backend with the same value used in response header in other VIP.
I-rule looks somthing like.
when HTTP_REQUEST { set persist_uri [string tolower [HTTP::uri]] switch -glob $persist_uri { "*/example1/content/*" { set reference_example1 [findstr [HTTP::uri] "/example1/content/" 18 32] persist uie $reference_example1 log local0. "$Persist on $reference_example1" } "*/example2/content/*" { set reference_example2 [findstr [HTTP::uri] "/example2/content/" 18 32] persist uie $reference_example2 log local0. "Persist on $reference_example2" } } when HTTP_RESPONSE { if { [HTTP::header exists "Referense_Header"] } { set reference_token [HTTP::header value "Referense_Header"] persist add uie $reference_token log local0. "Persist record in PaymentRequestToken Header , payment reference = $payment_token"} } }
(Pool selection and all other logic is done in I-rule attached to VIP).
Works perfect in my case!
Regards
//Goran
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