Skip to content

Commit 4076211

Browse files
authored
[Filebeat] Improve ECS categorization field mappings in kibana module (elastic#16652)
* Improve ECS categorization field mappings in kibana module - event.kind - event.outcome - event.type - convert pipeline to yaml Closes elastic#16168
1 parent 8b54797 commit 4076211

7 files changed

+410
-170
lines changed

CHANGELOG.next.asciidoc

+1
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
150150
- Improve ECS field mappings in aws module. {issue}16154[16154] {pull}16307[16307]
151151
- Improve ECS categorization field mappings in googlecloud module. {issue}16030[16030] {pull}16500[16500]
152152
- Improve ECS field mappings in haproxy module. {issue}16162[16162] {pull}16529[16529]
153+
- Improve ECS categorization field mappings in kibana module. {issue}16168[16168] {pull}16652[16652]
153154
- Improve the decode_cef processor by reducing the number of memory allocations. {pull}16587[16587]
154155
- Add `cloudfoundry` input to send events from Cloud Foundry. {pull}16586[16586]
155156
- Improve ECS categorization field mappings in iis module. {issue}16165[16165] {pull}16618[16618]

filebeat/module/kibana/log/ingest/pipeline.json

-169
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
description: Pipeline for parsing Kibana logs
2+
on_failure:
3+
- set:
4+
field: error.message
5+
value: '{{ _ingest.on_failure_message }}'
6+
processors:
7+
- rename:
8+
field: '@timestamp'
9+
target_field: event.created
10+
- rename:
11+
field: json
12+
target_field: kibana.log.meta
13+
- date:
14+
field: kibana.log.meta.@timestamp
15+
formats:
16+
- ISO8601
17+
target_field: '@timestamp'
18+
- remove:
19+
field: kibana.log.meta.@timestamp
20+
- rename:
21+
field: kibana.log.meta.message
22+
target_field: message
23+
- rename:
24+
field: kibana.log.meta.state
25+
target_field: kibana.log.state
26+
ignore_missing: true
27+
- rename:
28+
field: kibana.log.meta.pid
29+
target_field: process.pid
30+
- rename:
31+
field: kibana.log.meta.tags
32+
target_field: kibana.log.tags
33+
- rename:
34+
field: kibana.log.meta.res.statusCode
35+
target_field: http.response.status_code
36+
ignore_missing: true
37+
- rename:
38+
field: kibana.log.meta.res.responseTime
39+
target_field: temp.duration
40+
ignore_missing: true
41+
- script:
42+
lang: painless
43+
source: ctx.event.duration = Math.round(ctx.temp.duration * params.scale)
44+
params:
45+
scale: 1000000
46+
if: ctx.temp?.duration != null
47+
- remove:
48+
field: temp.duration
49+
ignore_missing: true
50+
- rename:
51+
field: kibana.log.meta.res.contentLength
52+
target_field: http.response.body.bytes
53+
ignore_missing: true
54+
- rename:
55+
field: kibana.log.meta.req.method
56+
target_field: http.request.method
57+
ignore_missing: true
58+
- rename:
59+
field: kibana.log.meta.req.headers.referer
60+
target_field: http.request.referrer
61+
ignore_missing: true
62+
- rename:
63+
field: kibana.log.meta.req.headers.user-agent
64+
target_field: user_agent.original
65+
ignore_missing: true
66+
- rename:
67+
field: kibana.log.meta.req.remoteAddress
68+
target_field: source.address
69+
ignore_missing: true
70+
- set:
71+
field: source.ip
72+
value: '{{source.address}}'
73+
if: ctx.source?.address != null
74+
- rename:
75+
field: kibana.log.meta.req.url
76+
target_field: url.original
77+
ignore_missing: true
78+
- remove:
79+
field: kibana.log.meta.req.referer
80+
ignore_missing: true
81+
- remove:
82+
field: kibana.log.meta.statusCode
83+
ignore_missing: true
84+
- remove:
85+
field: kibana.log.meta.method
86+
ignore_missing: true
87+
- append:
88+
field: service.name
89+
value: kibana
90+
- set:
91+
field: event.kind
92+
value: event
93+
- script:
94+
lang: painless
95+
source: >-
96+
if (ctx?.kibana?.log?.state != null) {
97+
if (ctx.kibana.log.state == "red") {
98+
ctx.event.type = "error";
99+
} else {
100+
ctx.event.type = "info";
101+
}
102+
}
103+
104+
- set:
105+
field: event.outcome
106+
value: success
107+
if: "ctx?.http?.response?.status_code != null && ctx.http.response.status_code < 400"
108+
- set:
109+
field: event.outcome
110+
value: failure
111+
if: "ctx?.http?.response?.status_code != null && ctx.http.response.status_code >= 400"

filebeat/module/kibana/log/manifest.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ var:
55
default:
66
- /var/log/kibana/kibana.stdout
77

8-
ingest_pipeline: ingest/pipeline.json
8+
ingest_pipeline: ingest/pipeline.yml
99
input: config/log.yml

0 commit comments

Comments
 (0)