Smart Variables
What Is Smart Variables?
Smart Variables makes it possible to write into a field a value that is calculated while the request is being processed instead of a fixed value. For example, instead of writing a certain IP address into a tracking key, "the IP address of the client that makes the request" is selected; the value is calculated again at every request.
A variable is added to a field in three ways:
- In the text fields the
fxbutton on the right of the field (the tooltip Add variable) opens the Add variable window and the variable is selected from the list. - In the content editors (the content pages, the WAF blocking page) the button is not on the right of the field but in the toolbar of the editor and its name is Add TR7 variable. The button is present only in the Visual editor mode.
- In the key lists there is no button: a new row is added with the first variable of the list and the variable is changed by clicking the label in the row. The same variable is not added to a list twice.
The variable text is also written or pasted into the field manually; a valid variable text turns into a label by itself after a short while.
The Add Variable Window
The window opens with the Add variable title while a new variable is being added and with the Edit variable title while an existing variable is being changed.
| Field | What it is for | How it is filled |
|---|---|---|
| Variable name | It lists the variables that can be used in that field | The list is in the form group name - variable name (e.g. Connection info - Client IP address); it is filtered by typing into the box |
| The argument field | It appears only in the variables that ask for additional information | Its label changes according to the variable selected: such as Header name, Cookie name, Table name and Format |
| Add functions | In order to use the value not as it is but processed | When it is opened, the Function 1 row comes with the To Base64 function; the rows added with start with JSON query and the $.key argument. Every row takes the result of the previous one. In the AGS OTP variables this row is not displayed |
| Summary | It shows the result of the selection with a readable sentence | It is not filled, it only shows; when it is hovered over, the long form opens in the tooltip |
| Submit | It writes the selection into the field and closes the window | It cannot be clicked while there is a missing or invalid argument |
In the list there are only the variables that can be produced in that field. When the same field is opened on a TCP vService, the list gets shorter; in a field that works at the response stage, the variables that belong to the response also enter the list.
How the Selected Variable Appears in the Field
After the selection, not a raw text but a label that shows the variable appears in the field:
- In the narrow fields and in the content editors the short name appears: such as
[↓IP],[↑Code]and[↓Country]. When the label is hovered over, its long name comes out in the tooltip. - In the cache, tracking, bandwidth and sampling key lists the long name appears: such as
[Source (client) IP address]; in these lists the short name comes out in the tooltip. In the Hash key, Custom format format keys and the manual log entries, on the other hand, the short name appears. - When the label is clicked, the window opens again with the Edit variable title and the variable, its argument and its functions are changed. In the content page editor the window opens with the Add variable title in this case as well.
In the content and text fields the variable is placed inside the text as this label; the text and the variable can be used mixed in the same field.
In Which Sections It Is Encountered
| Section | Field | What it is used for |
|---|---|---|
| vService · Persistence: Hash based | Hash key | To produce the key that determines to which server the request will go |
| vService · Session ID format: Custom Format | Custom format format keys | To form the session identity from the values specific to the client |
| vService · Debug on | Entry value in the Custom debug log entries table | To write the fields wanted into the debug log |
| Backend Service · Backend Group, SSL service checked | SNI | To produce from the request the SNI information that will be sent to the Backend Service |
| The cache profile · Dynamic caching on | Key | To separate the cache record according to the request |
| The log profile | Manual Log Line Format · Manual log entries | To write the fields wanted into the log line |
| The actions · traffic tracking | Fields to track | To count the traffic according to its source and to take an action according to the threshold |
| The actions · the quarantine (Tracking key: Manual) | Quarantine keys to track | To define the source that will be taken into quarantine |
| The actions · the captcha (Tracking type: Manual) | Quarantine tracking keys | To define the source in the captcha quarantine |
| The actions · redirection, header, path, traffic variable | Redirect location · Header content · New path info · Variable value | To produce the address, the header or the variable from the request |
| The actions · bandwidth (Limit type: Dynamic) | Key | To determine for whom the limit will be applied separately |
| The actions · traffic mirroring (sampling on) | Sampling key | To determine according to which value the requests to be copied will be selected |
| The content pages | Content | To write the information that belongs to the request onto the page shown |
| WAF · the blocking page source Manual content | Blocking page | To write the information that belongs to the request onto the blocking page |
| Bot/DDoS · the protection and quarantine cards | Redirect location · Quarantine tracking keys | To define the redirect location and the quarantine source |
Besides these, the same window is used in the Dynamic Condition, Dynamic List and AGS Condition conditions, in the report columns and in the AGS fields as well. The full list of the fields is on the Variables page.
Which Group for Which Job
| The job to be done | The group to look at |
|---|---|
| To identify the source (the tracking, quarantine, limit and persistence key) | Connection info |
| To make a decision according to the path, the method or the address | Request info |
| To read a header or cookie value | HTTP header info |
| To extract data from the body | Body info |
| To write the period and the time into the log line | Time info |
| To write the counter and the amount transferred | Stats |
| To separate the client according to the country, the browser or the bot state | Client info |
| To produce content according to the WAF result | WAF |
| To use the certificate and encryption information | SSL info |
| To read the amount of requests and data in a certain period | Tracking info |
| To combine more than one value and make a single key | Create variable |
| To make an operation according to the authenticated user | AGS variables |
| To use the status code of the response | The Response Line (the group without a label) |
| To write where the response comes from into the log line | Response source |
| The cache, the compression, the random number and the manual variables | Others |
All of the groups and the variables inside them are on the Variables page.
The Functions
If the value as it is is not enough, the Add functions row is opened and the value is used processed: converting to lowercase, taking a hash, extracting a field from inside JSON or XML, narrowing an IP address to a block, comparing with a list and so on. The functions are added one after another and are applied in the order in which they are added.
All of the functions are on the Converters page.
