HTTP header extractor enrichment

This enrichment allows to capture and store any header from HTTP request sent by website visitor to collector. HTTP are stored headers in the Thrift raw event payload by the Scala Stream Collector.

This community-contributed enrichment lets you specify headers that you want to extract via a regex pattern in the headersPattern parameter, if found each extracted header will end up a single derived context in the JSON Schema org.ietf/http_header/jsonschema/1-0-0.

Below configuration allows to extract all headers present in HTTP request, including cookies and auxiliary headers.

{
    "schema": "iglu:com.snowplowanalytics.snowplow.enrichments/http_header_extractor_config/jsonschema/1-0-0",
    "data": {
        "name": "http_header_extractor_config",
        "vendor": "com.snowplowanalytics.snowplow.enrichments",
        "enabled": true,
        "parameters": {
            "headersPattern": [".*"]
        }
    }
}

The data source for this enrichment is HTTP headers captured by the Scala Stream Collector and thus present in the Thrift raw event payload.

Note: This enrichment only works with events recorded by the Scala Stream Collector - the CloudFront and Clojure Collectors do not capture HTTP headers.

The name(s) of header(s) that are of interest to the user are extracted from the http_header_extractor_config.json.

The HTTP headers from the event payload are examined for presence and once pattern is found, value is captured and “inserted” as a single derived_contexts into the enriched/good stream/bucket.

As each key-value pair corresponding to the header is represented as a derived_contexts correlated to the JSON Schema org.ietf/http_header/jsonschema/1-0-0, the output of this enrichment is a separate entity with the data.name and data.value fields where data.name is the name of the header and data.value is its value.

If EMR enrichment is engaged (as opposed to Kinesis) the generated data ends up in org_ietf_http_header_1 table.