RULE_INIT

Description

Use this event to initialize global or static variables used within iRules.

Execution

This event is triggered under the following conditions;
  • when an iRule using the event is saved.
  • when the device starts up.
  • when the software is restarted.

Scope

The RULE_INIT event is global in scope and is triggered without the context of a virtual server or client to virtual server connection.

Namespace

Variables defined in this event are global across the F5 and share the same namespace with all other iRules. Any other irule that also sets a variable with the same name in another RULE_INIT event will overwrite the previously set value.

Limitations

Global variables modified by an iRule will demote the execution of the virtual to a single processor core. On a BIG-IP with a quad core processor, the virtual will only be able to use one of them. See CMP Compatibility for more details.

Examples

when RULE_INIT {
  set ::count 0
}

# static namespace is available in 10.0.0+
when RULE_INIT {
  set static::debug 1
}