ADC

Configure a selector

A selector is a filter for identifying requests. It consists of up to five individual Advanced policy expressions that identify request attributes such as the client IP address and the URL in the request. Each expression is a non-compound Advanced policy expression and is considered to be in an AND relationship with the other expressions. The following are some examples of selector expressions:

  • HTTP.REQ.URL
  • CLIENT.IP.SRC
  • HTTP.RES.BODY(1000).AFTER_STR("<string>").BEFORE_STR("<string>")"
  • CLIENT.IP.SRC.SUBNET(24)

Selectors are used in rate limiting and action analytics configurations. A selector is optional in a rate limiting configuration but is required in an action analytics configuration.

The order in which you specify parameters is significant. For example, if you configure an IP address and a domain (in that order) in one selector, and then specify the domain and the IP address (in the reverse order) in another selector, the NetScaler considers these values to be unique. This can lead to the same transaction being counted twice. Also, if multiple policies invoke the same selector, the NetScaler, again, can count the same transaction more than once.

If you modify an expression in a selector, you may get an error if any policy that invokes it is bound to a new policy label or bind point. For example, suppose that you create a selector named myLimitSelector1, invoke it from myLimitID1, and invoke the identifier from a DNS policy named dnsRateLimit1. If you change the expression in myLimitSelector1, you might receive an error when binding dnsRateLimit1 to a new bind point. The workaround is to modify these expressions before creating the policies that invoke them.

The NetScaler appliance provides built-in selectors for some of the most common use cases.

You can also configure a selector with expressions that identify the request attributes of your choice. For example, you might want to create a record for a request that arrives with a specific header. To evaluate the header, you can add HTTP.REQ.HEADER("<header_name>") to the selector that you intend to use.

To configure a selector by using the command line interface:

At the command prompt, type the following commands to configure a selector and verify the configuration:

  • add stream selector <name> <rule> ...
  • show stream selector

Example

> add stream selector myselector HTTP.REQ.URL CLIENT.IP.SRC
 Done
> show stream selector myselector
    Name: myselector
    Expressions:
        1) HTTP.REQ.URL
        2) CLIENT.IP.SRC
 Done
>
<!--NeedCopy-->

To modify or remove a selector by using the command line interface:

  • To modify a selector, type the set stream selector command, the name of the selector, and the rule parameter with the expressions. Enter the existing expressions that you want to retain, along with the new expressions that you want to add.
  • To remove a selector, type the rm stream selector command and the name of the selector.

To configure a selector by using the GUI:

  1. Navigate to AppExpert > Action Analytics > Selectors.
  2. In the details pane, do one of the following:
    • To create a selector, click Add.
    • To modify a selector, select the selector, and then click Edit.
  3. In the Create Selector or Configure Selector page, set the following parameters:
    • Name. To add a name for the selector, enter the name in the Name field. The Name must begin with an ASCII, alphanumeric, or underscore character. The name must contain only ASCII alphanumeric, underscore, hash, period, space, colon, at, equals, and hyphen characters.
    • Expressions. To add the expression to the selector configuration, click Insert. To remove an expression from the selector configuration, in the Expression box, select the expression, and then click Delete. Note: In the Expressions box, enter a valid parameter. For example, enter HTTP. Then, enter a period after this parameter. A drop-down menu appears. The contents of this menu provide the keywords that can follow the initial keyword that you entered. To select the next keyword in this expression prefix, double-click the selection in the drop-down menu. The Expressions text box displays both the first and second keywords for the expression prefix, for example, HTTP.REQ. Continue adding expression components until the complete expression is formed.
  4. Click Insert.
  5. Continue adding up to five non-compound expressions.
  6. Click Create and then Close.
Configure a selector