Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

iRule using HTTP Payload on universal persistence profile

Miley
Nimbostratus
Nimbostratus

Hi All

Seem to have hit a wall, what im trying to achive is to create a persitence record based on the transactionID.

when HTTP_REQUEST {
# Pull all xml data after <name>TransactionId</name><value><string> into variable trans_data
set trans_data [getfield [HTTP::payload 0] "<name>TransactionId</name>
<value>
<string" 2]
# Pull all xml data in trans_data before </string> into variable trans_id
set trans_id [getfield $trans_data "</string>" 1]
# Set trans_id as the value to persist on
persist uie $trans_id
# Write the persistence value to the NLB log (/var/log/ltm)
log local0. "WE RECORDED $trans_id AS THE PERSIST VARIABLE"
}

This pulls the TransactionID from

<?xml version="1.0"?>

<methodCall>

  <methodName>handleUSSDRequest</methodName>

  <params>

    <param>

      <value>

         <struct>

            <member>

              <name>TransactionId</name>

              <value>

                <string>334988643</string>

              </value>

            </member>

it seems to be recording the entry in the log:

Feb 17 16:09:37 info tmm[5600]: Rule /Common/USSDGWtransactionID <HTTP_REQUEST>: WE RECORDED >334988643 AS THE PERSIST VARIABLE

However i cant seem to find the entry in the persestance table and seem to be getting loads of errors:

Feb 18 09:07:43  err tmm[5600]: 01220001:3: TCL error: /Common/USSDGWtransactionID <HTTP_REQUEST> - attempt to use empty persistence key (line 😎     invoked from within "persist uie $trans_id"

Could anyone maybe shed some light on this?

2 REPLIES 2

Hello Miley.

[HTTP::payload] should be accesed from HTTP_REQUEST_DATA event, after collecting some bytes with the command HTTP::collect.

REF - https://clouddocs.f5.com/api/irules/HTTP__payload.html

So, if I were you, I would try to persist that record from the HTTP_REQUEST_DATA event (after capturing the payload data).

Regards,
Dario.

HTTP_REQUEST is used for client sider persistence.

 

How we can then incorporate server side persistence

In WHEN HTTP_RESPONSE and in persist add uie <variable>