Forum Discussion

roni_365915's avatar
roni_365915
Icon for Nimbostratus rankNimbostratus
Jul 04, 2018

Update iRule

Hi,

 

I have a rule that is looking in the table for some parameter (dest ip). I want to change the table ip value. how can I do that? it is ok that old sessions will still use the old.

 

1 Reply

  • Hi,

    simple example table with userip and name:

    Just log:

    set clientip [IP::client_addr]
    set tablevalue [table lookup $userip]
    
    if {$tablevalue  != ""} {
        set name $tablevalue 
        log local0. "IP $userip - name  $name"
    }
    

    Modify or delete:

    set clientip [IP::client_addr]
    set tablevalue [table lookup $userip]
    
    if {$tablevalue  != ""} {
        set name $tablevalue 
        log local0. "IP $userip - name  $name"
         delete
        table delete $userip
         then create
        table set $userip youssef 3600
    }
    

    You can also replace:

    table replace   
    table set $userip youssef 3600
    

    For info: https://devcentral.f5.com/wiki/iRules.table.ashx