Product Documentation

Configuring a Selector

Aug 31, 2016
A selector is a filter for identifying requests. It consists of up to five individual default syntax expressions that identify request attributes such as the client IP address and the URL in the request. Each expression is a non-compound default syntax expression and is considered to be in an AND relationship with the other expressions. 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 a 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 the following built-in selectors for some of the most common use cases:

Table 1. Built-in Selectors
Selector Selector Expressions
Top_URL HTTP.REQ.URL
Top_CLIENTS CLIENT.IP.SRC
Top_URL_CLIENTS_LBVSERVER
  1. HTTP.REQ.URL
  2. CLIENT.IP.SRC
  3. HTTP.REQ.LB_VSERVER.NAME
Top_URL_CLIENTS_CSVSERVER
  1. HTTP.REQ.URL
  2. CLIENT.IP.SRC
  3. HTTP.REQ.CS_VSERVER.NAME
Top_MSSQL_QUERY_DB_LBVSERVER
  1. MSSQL.REQ.QUERY.TEXT
  2. MSSQL.REQ.LB_VSERVER.NAME
Top_MYSQL_QUERY_DB_LBVSERVER
  1. MYSQL.REQ.QUERY.TEXT
  2. MYSQL.REQ.LB_VSERVER.NAME

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 
>

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 configuration utility

  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 Open.
  3. In the Create Limit Selector or Configure Limit Selector dialog box, set one or more of the following parameters:
    • Name
    • Expressions
      To add the expression to the selector configuration, click Add. To remove an expression from the selector configuration, in the Expression box, select the expression, and then click Remove.
      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 Add.
  5. Continue adding up to five non-compound expressions.
  6. Click Create or OK.