Forum Discussion

sb_2323_80570's avatar
sb_2323_80570
Icon for Nimbostratus rankNimbostratus
Apr 27, 2010

Using same variable accross different iRules

Hi,

 

 

Is there way of using the output of one iRule and using in another iRule, eg using a variable (x) derived from and iRule which is triggered at CLIENT_CONNECTED and then using the variable (x) for a iRule that is triggered LB_SELECTED stage.

 

 

 

Any help would be greatly appreciated

 

 

 

1 Reply

  • Hi,

     

     

    iRule variables are either:

     

     

    - local: (like $my_var) specific to the TCP connection and accessible across all events after they've been declared regardless of which iRule they're declared in

     

    - global: (like $::my_var) accessible across all TCP connections

     

    - static: (like $static::my_var) New in 10.0.0. A namespace for creating global variables to hold constant values in a CMP-compatible fashion. This namespace is intended only for use with values that will not change. While it is possible to alter the value of a global variable in the static namespace, this value will not be propagated to other CMP nodes in the system. Therefore, doing so may lead to unexpected results. If you need to share information across CMP nodes, you should use the session command instead. (from http://devcentral.f5.com/wiki/default.aspx/iRules/static)

     

     

    Here is a related post which details the first two variable types:

     

     

    Global variables shared across virtual servers

     

    http://devcentral.f5.com/Default.aspx?tabid=53&view=topic&postid=85746&ptarget=85747

     

     

    Aaron