HTTP header extractor enrichment
This enrichment can extract name/value pairs from the HTTP headers in the tracker request to the Collector, and attach them to the event as entities.
Configuration
The enrichment takes one parameter:
| Parameter | Required | Description |
|---|---|---|
headersPattern | ✅ | A regex for matching headers. |
- Console
- Self-Hosted
Configure the parameters in the Console enrichment editor. For example:
{
"headersPattern": ".*"
}
For Self-Hosted, provide a complete JSON. For example:
{
"schema": "iglu:com.snowplowanalytics.snowplow.enrichments/http_header_extractor_config/jsonschema/1-0-0",
"data": {
"vendor": "com.snowplowanalytics.snowplow.enrichments",
"name": "http_header_extractor_config",
"enabled": false,
"parameters": {
"headersPattern": ".*"
}
}
}
Unsure if your enrichment configuration is correct or works as expected? You can easily test it using Snowplow Micro, either through Console or on your machine.
All the headers that will match the regular expression defined in headersPattern parameter will be attached to the event.
In the example configuration, all the headers of the request would be attached to the event because of the .* regular expression pattern.
If you're only interested in the host, for example, use:
"headersPattern": "(?i)Host"
Output
For each header matching the regex defined in headersPattern, an http_header entity is added to the enriched event. Each entity contains only one name/value pair.
http_header
Entityiglu:org.ietf/http_header/jsonschema/1-0-0Example data
{
"name": "Accept-Language",
"value": "en-US,en;q=0.9"
}
Properties and schema
- Table
- Complete JSON schema
| Property | Description |
|---|---|
namestring | Required. |
valuestring | Required. |
{
"$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#",
"description": "Schema for a single HTTP header",
"self": {
"vendor": "org.ietf",
"name": "http_header",
"format": "jsonschema",
"version": "1-0-0"
},
"type": "object",
"properties": {
"name": {
"type": "string",
"maxLength": 4096
},
"value": {
"type": "string",
"maxLength": 4096
}
},
"required": [
"name",
"value"
],
"additionalProperties": false
}