Install the Add Request ID integration
Install Add Request ID from Azion Marketplace and run it on a firewall, so every request carries a header with a unique identifier.
You install the Add Request ID integration from Azion Marketplace and run it on a Firewall, from Azion Console. The integration adds a header to the incoming request object, and the header assigns a unique identifier to each HTTP request that Azion serves. Use the identifier to track single requests, analyze logs, and find issues: it cross-references the records of Data Stream and Real-Time Events with the internal logs of your infrastructure.
Five objects have to exist before a request carries the header: the installed function, a firewall carrying the Functions module, a function instance, a Rules Engine rule with the Run Function behavior, and a workload deployment bound to the firewall. Each section below creates one of them.
Prerequisites
- An Azion account. To sign in, refer to How to access Azion Console.
- An application served by a workload, whose deployment you bind to the firewall in the last section.
- The Azion CLI installed and authorized, for the last section.
- Turning on a product or a module can generate usage costs, such as function executions. For more information, refer to Pricing.
Install the integration
The function is installed once per account. To install it:
Access Azion Console > Marketplace.
Enter Add Request ID in the Search on Marketplace field, then select the integration’s card. Browsing the cards and the categories reaches the same page.
The card shows Successfully installed! and Latest version installed!, and the function appears in the Function list of the Create Instance drawer.
Create the firewall
The firewall is where the function is instanced and where the rule that runs it lives. To create one:
Access Azion Console > Firewalls, then create a firewall.
In the General section, enter a Name. For example: request-id-firewall.
In the Modules section, turn on the Functions switch.
The firewall shows a Functions Instances tab while the Functions module stays on. To use an existing firewall instead, turn on its Functions module and save it. For every setting on this form, refer to Set a firewall’s main settings.
Create the function instance
The instance runs without arguments. Its one optional argument changes the name of the header that carries the request ID. To create the instance:
In Firewalls, select your firewall, then select the Functions Instances tab.
A firewall that has no instance shows the same action as Function Instance. The Create Instance drawer opens.
In Name, enter a name. For example: add-request-id.
In Function, select the Add Request ID function. The list holds only the functions that run on a firewall.
In Arguments, the editor is prefilled with the integration’s default arguments in JSON. To change the header name, set header_name, as the next section describes.
The instance is listed in the Functions Instances tab.
Arguments
| JSON Args key | Environment Variable Name | Data Type | Default Value | Description |
|---|---|---|---|---|
header_name | AZION_REQUEST_ID_HEADER_NAME | String | x-azn-request-id | The name of the header where the function inserts the request ID. If the argument is not a non-empty string, the function uses the default value |
Create the rule
The instance adds no header until a rule runs it. A Rules Engine for Firewall rule selects the requests that reach the instance, through a Run Function behavior. To create the rule:
In Firewalls, select your firewall, then select the Rules Engine tab.
In Name, enter a name. For example: Run Add Request ID.
In the Criteria section, select the domains that run the integration. For example: if Host matches yourdomain.com.
In the Behaviors section, select Run Function, then select the instance by the name you gave it.
The firewall runs the instance on every request to the domains in the criterion.
Bind the firewall to the workload
The binding is on the workload’s deployment, so create a deployment that names both the application and the firewall:
The command prints the id of the new deployment:
Requests to the workload’s domain reach the firewall, and each one carries the request ID header.