POLICY::targets

Description

Returns or sets properties of the policy rule targets for the policies associated with the virtual server that the iRule is enabled on. A policy rule target can be considered an action that the policy uses if the rule conditions are met.
As of v11.4 the following targets are available:
Policy target name Description Version added
wam Application Acceleration Manager (AAM) v11.4
asm Application Security Manager v11.4
log Log v11.4
http-cookie HTTP cookie v11.4
http-header HTTP header v11.4
http-host HTTP host header v11.4
http-referer HTTP referer header v11.4
http-set-cookie HTTP set-cookie header v11.4
http-uri HTTP URI v11.4
tcl Set a Tcl variable name and value v11.4
tcp-nagle TCP Nagels algorithm v11.4

Syntax

POLICY::targets
POLICY::targets [ wam | asm | http-cookie | http-header | http-host | http-referer | http-set-cookie | http-uri | http-reply | log | tcl | tcp-nagle ]

POLICY::targets

  • Returns a list of policy target(s) attached to the virtual server. These are typically virtual server profiles or features which can be enabled|disabled or modified per iRule execution via policies.

Examples

# Log the policy targets for this virtual server
when HTTP_REQUEST {

    # Log the policy targets enabled on this virtual server
    log local0. "\[POLICY::targets\]: [POLICY::targets]"

    # Loop through each possible target type and log whether it is enabled or not (1 for enabled, 0 for not enabled)
    foreach target {asm wam log http-cookie http-header http-host http-referer http-set-cookie http-uri log tcl tcp-nagle} {
        log local0. "\[POLICY::targets $target\]: [POLICY::targets $target]"
    }
}

# /var/log/ltm output:
<HTTP_REQUEST>: [POLICY::targets]: log forward server-ssl
<HTTP_REQUEST>: [POLICY::targets asm]: 0
<HTTP_REQUEST>: [POLICY::targets wam]: 0
<HTTP_REQUEST>: [POLICY::targets http-cookie]: 0
<HTTP_REQUEST>: [POLICY::targets http-header]: 0
<HTTP_REQUEST>: [POLICY::targets http-host]: 0
<HTTP_REQUEST>: [POLICY::targets http-referer]: 0
<HTTP_REQUEST>: [POLICY::targets http-set-cookie]: 0
<HTTP_REQUEST>: [POLICY::targets http-uri]: 0
<HTTP_REQUEST>: [POLICY::targets log]: 1
<HTTP_REQUEST>: [POLICY::targets tcl]: 0
<HTTP_REQUEST>: [POLICY::targets tcp-nagle]: 0