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.
Improve ECS categorization field mappings in logstash module (elastic…
…#16668) - event.kind - event.type - convert pipeline to yaml Closes elastic#16169
- Loading branch information
Showing
16 changed files
with
260 additions
and
310 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 was deleted.
Oops, something went wrong.
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,50 @@ | ||
description: Pipeline for parsing logstash logs | ||
on_failure: | ||
- set: | ||
field: error.message | ||
value: '{{ _ingest.on_failure_message }}' | ||
processors: | ||
- json: | ||
field: message | ||
target_field: logstash.log | ||
- rename: | ||
field: '@timestamp' | ||
target_field: event.created | ||
- convert: | ||
field: logstash.log.timeMillis | ||
type: string | ||
- date: | ||
field: logstash.log.timeMillis | ||
formats: | ||
- UNIX_MS | ||
target_field: '@timestamp' | ||
- rename: | ||
field: logstash.log.loggerName | ||
target_field: logstash.log.module | ||
- remove: | ||
field: | ||
- message | ||
- logstash.log.timeMillis | ||
- rename: | ||
field: logstash.log.logEvent.message | ||
target_field: message | ||
- rename: | ||
field: logstash.log.logEvent | ||
target_field: logstash.log.log_event | ||
- rename: | ||
field: logstash.log.level | ||
target_field: log.level | ||
- set: | ||
field: event.kind | ||
value: event | ||
- script: | ||
lang: painless | ||
source: >- | ||
def errorLevels = ["ERROR", "FATAL"]; | ||
if (ctx?.log?.level != null) { | ||
if (errorLevels.contains(ctx.log.level)) { | ||
ctx.event.type = "error"; | ||
} else { | ||
ctx.event.type = "info"; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,59 @@ | ||
description: Pipeline for parsing logstash logs in the plain format | ||
on_failure: | ||
- set: | ||
field: error.message | ||
value: '{{ _ingest.on_failure_message }}' | ||
processors: | ||
- grok: | ||
field: message | ||
pattern_definitions: | ||
LOGSTASH_CLASS_MODULE: '[\w\.]+' | ||
LOGSTASH_LOGLEVEL: INFO|ERROR|DEBUG|FATAL|WARN|TRACE | ||
GREEDYMULTILINE: |- | ||
(.| | ||
)* | ||
patterns: | ||
- \[%{TIMESTAMP_ISO8601:logstash.log.timestamp}\]\[%{LOGSTASH_LOGLEVEL:log.level}\s?\]\[%{LOGSTASH_CLASS_MODULE:logstash.log.module}\s*\]\[%{WORD:logstash.log.pipeline_id}\] | ||
%{GREEDYMULTILINE:message} | ||
- \[%{TIMESTAMP_ISO8601:logstash.log.timestamp}\]\[%{LOGSTASH_LOGLEVEL:log.level}\s?\]\[%{LOGSTASH_CLASS_MODULE:logstash.log.module}\s*\] | ||
%{GREEDYMULTILINE:message} | ||
- rename: | ||
field: '@timestamp' | ||
target_field: event.created | ||
- date: | ||
if: ctx.event.timezone == null | ||
field: logstash.log.timestamp | ||
target_field: '@timestamp' | ||
formats: | ||
- yyyy-MM-dd'T'HH:mm:ss,SSS | ||
on_failure: | ||
- append: | ||
field: error.message | ||
value: '{{ _ingest.on_failure_message }}' | ||
- date: | ||
if: ctx.event.timezone != null | ||
field: logstash.log.timestamp | ||
target_field: '@timestamp' | ||
formats: | ||
- yyyy-MM-dd'T'HH:mm:ss,SSS | ||
timezone: '{{ event.timezone }}' | ||
on_failure: | ||
- append: | ||
field: error.message | ||
value: '{{ _ingest.on_failure_message }}' | ||
- remove: | ||
field: logstash.log.timestamp | ||
- set: | ||
field: event.kind | ||
value: event | ||
- script: | ||
lang: painless | ||
source: >- | ||
def errorLevels = ["ERROR", "FATAL"]; | ||
if (ctx?.log?.level != null) { | ||
if (errorLevels.contains(ctx.log.level)) { | ||
ctx.event.type = "error"; | ||
} else { | ||
ctx.event.type = "info"; | ||
} | ||
} |
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
Oops, something went wrong.