forked from elastic/integrations
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AWS][Cloudfront Logs] - Implemented GROK processor based ipv6/v4 par…
…sing in AWS Cloudfront Logs data stream (elastic#11829) * The regex pattern used for the ipv6 was overly complex and caused errors inElasticsearch. This change simplifies and fixes the grok-based IPv4/IPv4 parsing by adding a new helper pipeline invoked iteratively over ip fields via a foreach. Also add a painless script to handle 'localhost' literal addresses. * Also run elastic-package format.
- Loading branch information
Showing
43 changed files
with
192 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1336,4 +1336,4 @@ | |
} | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...ges/aws/data_stream/cloudfront_logs/elasticsearch/ingest_pipeline/pipeline_process_ip.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
description: Pipeline for triggering the grok processor and helper scripts to effectively parse and append individual ipv6/v4 addresses. | ||
|
||
processors: | ||
- grok: | ||
field: _ingest._value | ||
tag: grok_parse_x_forwarded_for_ipv4_and_ipv6_addresses | ||
ignore_missing: true | ||
ignore_failure: true | ||
patterns: | ||
- "^%{IPV4:_tmp.valid_ip}$" | ||
- "^%{IPV6:_tmp.valid_ip}$" | ||
- "^%{IPV6NOCOMPRESS:_tmp.valid_ip}$" | ||
- "^\\[%{IPV6:_tmp.valid_ip}\\]$" | ||
pattern_definitions: | ||
IPV6NOCOMPRESS: '([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}' | ||
on_failure: | ||
- set: | ||
field: _tmp.invalid_ip | ||
value: "{{_ingest._value}}" | ||
- append: | ||
field: error.message | ||
value: 'Processor {{{_ingest.on_failure_processor_type}}} with tag {{{_ingest.on_failure_processor_tag}}} in pipeline {{{_ingest.on_failure_pipeline}}} failed with message: {{{_ingest.on_failure_message}}}' | ||
- append: | ||
field: network.forwarded_ip | ||
value: "{{_tmp.valid_ip}}" | ||
if: ctx._tmp.valid_ip != null && ctx._tmp.valid_ip != "" | ||
allow_duplicates: false | ||
- append: | ||
field: _tmp.invalid_ips | ||
value: "{{_tmp.invalid_ip}}" | ||
if: ctx._tmp.invalid_ip != null && ctx._tmp.invalid_ip != "" | ||
allow_duplicates: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 19 additions & 19 deletions
38
packages/aws/data_stream/ec2_metrics/_dev/test/pipeline/test-ec2-metrics-from-firehose.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
{ | ||
"events": [ | ||
{ | ||
"@timestamp": "2024-08-06T22:25:00.000Z", | ||
"agent.type": "firehose", | ||
"aws.cloudwatch.namespace": "AWS/EC2", | ||
"aws.ec2.metrics.CPUUtilization.avg": 21.96, | ||
"cloud.account.id": "123456789012", | ||
"cloud.instance.id": "i-08b34b681949f9fab", | ||
"cloud.provider": "aws", | ||
"cloud.region": "us-east-1", | ||
"data_stream.dataset": "aws.ec2_metrics", | ||
"data_stream.namespace": "default", | ||
"data_stream.type": "metrics", | ||
"ecs.version": "8.11.0", | ||
"event.agent_id_status": "missing", | ||
"event.ingested": "2024-08-06T22:26:25Z", | ||
"event.module": "aws" | ||
} | ||
] | ||
"events": [ | ||
{ | ||
"@timestamp": "2024-08-06T22:25:00.000Z", | ||
"agent.type": "firehose", | ||
"aws.cloudwatch.namespace": "AWS/EC2", | ||
"aws.ec2.metrics.CPUUtilization.avg": 21.96, | ||
"cloud.account.id": "123456789012", | ||
"cloud.instance.id": "i-08b34b681949f9fab", | ||
"cloud.provider": "aws", | ||
"cloud.region": "us-east-1", | ||
"data_stream.dataset": "aws.ec2_metrics", | ||
"data_stream.namespace": "default", | ||
"data_stream.type": "metrics", | ||
"ecs.version": "8.11.0", | ||
"event.agent_id_status": "missing", | ||
"event.ingested": "2024-08-06T22:26:25Z", | ||
"event.module": "aws" | ||
} | ||
] | ||
} |
Oops, something went wrong.