Skip to content

Commit

Permalink
[Filebeat] Improve ECS categorization field mappings in kibana module (
Browse files Browse the repository at this point in the history
…elastic#16652)

* Improve ECS categorization field mappings in kibana module

- event.kind
- event.outcome
- event.type
- convert pipeline to yaml

Closes elastic#16168

(cherry picked from commit 4076211)
  • Loading branch information
leehinman committed Mar 3, 2020
1 parent 6f5bba0 commit e007d6f
Show file tree
Hide file tree
Showing 7 changed files with 410 additions and 170 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Add ECS categorization fields to activemq module. {issue}16151[16151] {pull}16201[16201]
- Improve ECS field mappings in aws module. {issue}16154[16154] {pull}16307[16307]
- Improve ECS categorization field mappings in googlecloud module. {issue}16030[16030] {pull}16500[16500]
- Improve ECS categorization field mappings in kibana module. {issue}16168[16168] {pull}16652[16652]
- Add `cloudfoundry` input to send events from Cloud Foundry. {pull}16586[16586]
- Improve ECS field mappings in haproxy module. {issue}16162[16162] {pull}16529[16529]

Expand Down
169 changes: 0 additions & 169 deletions filebeat/module/kibana/log/ingest/pipeline.json

This file was deleted.

111 changes: 111 additions & 0 deletions filebeat/module/kibana/log/ingest/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
description: Pipeline for parsing Kibana logs
on_failure:
- set:
field: error.message
value: '{{ _ingest.on_failure_message }}'
processors:
- rename:
field: '@timestamp'
target_field: event.created
- rename:
field: json
target_field: kibana.log.meta
- date:
field: kibana.log.meta.@timestamp
formats:
- ISO8601
target_field: '@timestamp'
- remove:
field: kibana.log.meta.@timestamp
- rename:
field: kibana.log.meta.message
target_field: message
- rename:
field: kibana.log.meta.state
target_field: kibana.log.state
ignore_missing: true
- rename:
field: kibana.log.meta.pid
target_field: process.pid
- rename:
field: kibana.log.meta.tags
target_field: kibana.log.tags
- rename:
field: kibana.log.meta.res.statusCode
target_field: http.response.status_code
ignore_missing: true
- rename:
field: kibana.log.meta.res.responseTime
target_field: temp.duration
ignore_missing: true
- script:
lang: painless
source: ctx.event.duration = Math.round(ctx.temp.duration * params.scale)
params:
scale: 1000000
if: ctx.temp?.duration != null
- remove:
field: temp.duration
ignore_missing: true
- rename:
field: kibana.log.meta.res.contentLength
target_field: http.response.body.bytes
ignore_missing: true
- rename:
field: kibana.log.meta.req.method
target_field: http.request.method
ignore_missing: true
- rename:
field: kibana.log.meta.req.headers.referer
target_field: http.request.referrer
ignore_missing: true
- rename:
field: kibana.log.meta.req.headers.user-agent
target_field: user_agent.original
ignore_missing: true
- rename:
field: kibana.log.meta.req.remoteAddress
target_field: source.address
ignore_missing: true
- set:
field: source.ip
value: '{{source.address}}'
if: ctx.source?.address != null
- rename:
field: kibana.log.meta.req.url
target_field: url.original
ignore_missing: true
- remove:
field: kibana.log.meta.req.referer
ignore_missing: true
- remove:
field: kibana.log.meta.statusCode
ignore_missing: true
- remove:
field: kibana.log.meta.method
ignore_missing: true
- append:
field: service.name
value: kibana
- set:
field: event.kind
value: event
- script:
lang: painless
source: >-
if (ctx?.kibana?.log?.state != null) {
if (ctx.kibana.log.state == "red") {
ctx.event.type = "error";
} else {
ctx.event.type = "info";
}
}
- set:
field: event.outcome
value: success
if: "ctx?.http?.response?.status_code != null && ctx.http.response.status_code < 400"
- set:
field: event.outcome
value: failure
if: "ctx?.http?.response?.status_code != null && ctx.http.response.status_code >= 400"
2 changes: 1 addition & 1 deletion filebeat/module/kibana/log/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ var:
default:
- /var/log/kibana/kibana.stdout

ingest_pipeline: ingest/pipeline.json
ingest_pipeline: ingest/pipeline.yml
input: config/log.yml
Loading

0 comments on commit e007d6f

Please sign in to comment.