forked from elastic/beats
-
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.
[Filebeat] Improve ECS categorization mappings in envoyproxy module. (e…
…lastic#18395) * Improve ECS categorization mappings in envoyproxy module. - convert pipeline to yaml - explicitly set ECS version - event.category - event.kind - event.outcome - event.type - network.protocol - network.transport - related.ip Closes elastic#16161 (cherry picked from commit 7c3e38d)
- Loading branch information
Showing
15 changed files
with
360 additions
and
356 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,7 @@ paths: | |
{{ end }} | ||
tags: {{.tags}} | ||
processors: | ||
- add_fields: | ||
target: '' | ||
fields: | ||
ecs.version: 1.5.0 |
47 changes: 0 additions & 47 deletions
47
x-pack/filebeat/module/envoyproxy/log/ingest/pipeline-entry.json
This file was deleted.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
x-pack/filebeat/module/envoyproxy/log/ingest/pipeline-entry.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,47 @@ | ||
description: Pipeline for normalizing envoyproxy logs | ||
processors: | ||
- pipeline: | ||
if: ctx.message.charAt(0) != (char)("{") | ||
name: '{< IngestPipeline "pipeline-plaintext" >}' | ||
- pipeline: | ||
if: ctx.message.charAt(0) == (char)("{") | ||
name: '{< IngestPipeline "pipeline-json" >}' | ||
- pipeline: | ||
name: '{< IngestPipeline "pipeline-geo-as" >}' | ||
- set: | ||
field: event.created | ||
value: '{{@timestamp}}' | ||
- append: | ||
field: related.ip | ||
value: "{{source.ip}}" | ||
if: "ctx?.source?.ip != null" | ||
- append: | ||
field: related.ip | ||
value: "{{destination.ip}}" | ||
if: "ctx?.destination?.ip != null" | ||
- set: | ||
field: event.kind | ||
value: event | ||
- append: | ||
field: event.category | ||
value: network | ||
- append: | ||
field: event.outcome | ||
value: failure | ||
if: "ctx?.envoyproxy?.response_flags != null" | ||
- append: | ||
field: event.outcome | ||
value: success | ||
if: "ctx?.envoyproxy?.response_flags == null" | ||
- set: | ||
field: '@timestamp' | ||
value: '{{timestamp}}' | ||
if: ctx.timestamp != null | ||
- remove: | ||
field: | ||
- timestamp | ||
ignore_failure: true | ||
on_failure: | ||
- set: | ||
field: error.message | ||
value: 'pipeline-entry: {{ _ingest.on_failure_message }}' |
94 changes: 0 additions & 94 deletions
94
x-pack/filebeat/module/envoyproxy/log/ingest/pipeline-http.json
This file was deleted.
Oops, something went wrong.
61 changes: 61 additions & 0 deletions
61
x-pack/filebeat/module/envoyproxy/log/ingest/pipeline-http.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,61 @@ | ||
description: Pipeline for normalizing envoy HTTP ACCESS logs | ||
processors: | ||
- script: | ||
lang: painless | ||
source: >- | ||
ctx['http'] = new HashMap(); | ||
def p = ctx.proto.indexOf ('/'); | ||
def l = ctx.proto.length(); | ||
ctx.http.version = ctx.proto.substring(p+1, l); | ||
ignore_failure: true | ||
- rename: | ||
field: method | ||
target_field: http.request.method | ||
- rename: | ||
field: path | ||
target_field: url.path | ||
- convert: | ||
field: response_code | ||
type: long | ||
- rename: | ||
field: response_code | ||
target_field: http.response.status_code | ||
- rename: | ||
field: bytes_received | ||
target_field: http.response.body.bytes | ||
- convert: | ||
field: http.response.body.bytes | ||
type: long | ||
- rename: | ||
field: bytes_sent | ||
target_field: http.request.body.bytes | ||
- convert: | ||
field: http.request.body.bytes | ||
type: long | ||
- script: | ||
lang: painless | ||
source: ctx.envoyproxy.upstream_service_time = Math.round(Double.parseDouble(ctx.upstream_service_time) * params.scale) | ||
params: | ||
scale: 1000000 | ||
if: ctx.upstream_service_time != null && ctx.upstream_service_time != '-' | ||
- set: | ||
field: envoyproxy.proxy_type | ||
value: http | ||
- set: | ||
field: url.domain | ||
value: '{{envoyproxy.authority}}' | ||
- user_agent: | ||
field: user_agent.original | ||
ignore_missing: true | ||
- append: | ||
field: event.type | ||
value: | ||
- connection | ||
- protocol | ||
- set: | ||
field: network.protocol | ||
value: http | ||
on_failure: | ||
- set: | ||
field: error.message | ||
value: 'pipeline-http: {{ _ingest.on_failure_message }}' |
47 changes: 0 additions & 47 deletions
47
x-pack/filebeat/module/envoyproxy/log/ingest/pipeline-json.json
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
x-pack/filebeat/module/envoyproxy/log/ingest/pipeline-json.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,26 @@ | ||
description: Pipeline for normalizing envoyproxy access logs | ||
processors: | ||
- json: | ||
field: message | ||
target_field: json | ||
- remove: | ||
field: | ||
- message | ||
ignore_failure: true | ||
- rename: | ||
field: json.message | ||
target_field: message | ||
ignore_failure: true | ||
- rename: | ||
field: json.kubernetes | ||
target_field: kubernetes | ||
ignore_failure: true | ||
- remove: | ||
field: | ||
- json | ||
- pipeline: | ||
name: '{< IngestPipeline "pipeline-plaintext" >}' | ||
on_failure: | ||
- set: | ||
field: error.message | ||
value: 'pipeline-json: {{ _ingest.on_failure_message }}' |
Oops, something went wrong.