ltm rule command priority
iRule(1) BIG-IP TMSH Manual iRule(1)
priority
Sets the order of execution for iRule events.
SYNOPSIS
priority EVENT_PRIORITY
DESCRIPTION
The priority command is used as an attribute associated with any iRule event. When the iRules are loaded into
the internal iRules engine for a given virtual server, they are stored in a table with the event name and a
priority (with a default of 500). Lower numbered priority events are evaluated before higher numbered
priority events: When an event is triggered an event, the irules engine passes control to each of the code
blocks for that given event in the order of lowest to highest priority. Multiple events with the same priority
will be executed in the order they are inserted into the table. The valid values for the priority are 0 to
1000 inclusive. You can assign a priority between 1 and 1000 in one of two ways: either with the priority
command at the outermost scope of a rule, in which case the designated priority is used for all subsequent
events; or as an additional argument to the when command, in which the priority is only used for that event.
Syntax
priority nnn
* priority for all subsequent events
when priority nnn
* priority for a particular event declaration.
The value of nnn can be 0 to 1000 inclusive.
RETURN VALUE
VALID DURING
ANY_EVENT
EXAMPLES
In this example, the first event is assigned priority 700 and both
subsequent events are assigned priority 400. The second events will be
evaluated before the other rules with a priority > 400.
rule my_test_rule {
priority 700
when HTTP_REQUEST {
HTTP::header insert ORIG_CLIENT_IP [IP::remote_addr]
}
priority 400
when CLIENT_ACCEPTED {
log "Client [IP::remote_addr] connected"
}
when HTTP_REQUEST {
log "Requested URI: [HTTP::host][HTTP::uri]"
}
}
In this example, one event is assigned priority 700, another is
defaulted to 500 and the third is 400:
rule my_test_rule {
when HTTP_REQUEST priority 700 {
HTTP::header insert ORIG_CLIENT_IP [IP::remote_addr]
}
when CLIENT_ACCEPTED priority 400 {
log "Client [IP::remote_addr] connected"
}
when HTTP_REQUEST {
log "Requested URI: [HTTP::host][HTTP::uri]"
}
}
HINTS
SEE ALSO
CHANGE LOG
@BIGIP-9.0.0 --First introduced the command.
BIG-IP 2020-06-23 iRule(1)