Skip to content

Commit 6e99eb6

Browse files
authored
Improve ECS categorization field mapping in icinga (#16533) (#16956)
- event.kind - event.type Closes #16164 (cherry picked from commit b82a427)
1 parent c61369b commit 6e99eb6

File tree

13 files changed

+127
-96
lines changed

13 files changed

+127
-96
lines changed

CHANGELOG.next.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
241241
- Improve ECS categorization field mappings in iis module. {issue}16165[16165] {pull}16618[16618]
242242
- Improve the decode_cef processor by reducing the number of memory allocations. {pull}16587[16587]
243243
- Improve ECS categorization field mapping in kafka module. {issue}16167[16167] {pull}16645[16645]
244+
- Improve ECS categorization field mapping in icinga module. {issue}16164[16164] {pull}16533[16533]
244245

245246
*Heartbeat*
246247

filebeat/module/icinga/debug/ingest/pipeline.json

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
description: Pipeline for parsing icinga debug logs
2+
processors:
3+
- grok:
4+
field: message
5+
patterns:
6+
- '\[%{TIMESTAMP:icinga.debug.timestamp}\] %{WORD:log.level}/%{WORD:icinga.debug.facility}:
7+
%{GREEDYMULTILINE:message}'
8+
ignore_missing: true
9+
pattern_definitions:
10+
TIMESTAMP: '%{YEAR}-%{MONTHNUM}-%{MONTHDAY} %{HOUR}:%{MINUTE}:%{SECOND} %{ISO8601_TIMEZONE}'
11+
GREEDYMULTILINE: |-
12+
(.|
13+
)*
14+
- date:
15+
field: icinga.debug.timestamp
16+
target_field: '@timestamp'
17+
formats:
18+
- yyyy-MM-dd HH:mm:ss Z
19+
ignore_failure: true
20+
- remove:
21+
field: icinga.debug.timestamp
22+
- set:
23+
field: event.kind
24+
value: event
25+
- script:
26+
lang: painless
27+
source: >-
28+
def errorLevels = ["warning", "critical"];
29+
if (ctx?.log?.level != null) {
30+
if (errorLevels.contains(ctx.log.level)) {
31+
ctx.event.type = "error";
32+
} else {
33+
ctx.event.type = "info";
34+
}
35+
}
36+
on_failure:
37+
- set:
38+
field: error.message
39+
value: '{{ _ingest.on_failure_message }}'

filebeat/module/icinga/debug/manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ var:
99
os.windows:
1010
- c:/programdata/icinga2/var/log/icinga2/debug.log*
1111

12-
ingest_pipeline: ingest/pipeline.json
12+
ingest_pipeline: ingest/pipeline.yml
1313
input: config/debug.yml

filebeat/module/icinga/debug/test/test.log-expected.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
{
33
"@timestamp": "2017-04-04T11:43:09.000Z",
44
"event.dataset": "icinga.debug",
5+
"event.kind": "event",
56
"event.module": "icinga",
7+
"event.type": "info",
68
"fileset.name": "debug",
79
"icinga.debug.facility": "GraphiteWriter",
810
"input.type": "log",
@@ -14,7 +16,9 @@
1416
{
1517
"@timestamp": "2017-04-04T11:43:09.000Z",
1618
"event.dataset": "icinga.debug",
19+
"event.kind": "event",
1720
"event.module": "icinga",
21+
"event.type": "info",
1822
"fileset.name": "debug",
1923
"icinga.debug.facility": "IdoMysqlConnection",
2024
"input.type": "log",
@@ -26,7 +30,9 @@
2630
{
2731
"@timestamp": "2017-04-04T11:43:11.000Z",
2832
"event.dataset": "icinga.debug",
33+
"event.kind": "event",
2934
"event.module": "icinga",
35+
"event.type": "info",
3036
"fileset.name": "debug",
3137
"icinga.debug.facility": "Process",
3238
"input.type": "log",

filebeat/module/icinga/main/ingest/pipeline.json

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
description: Pipeline for parsing icinga main logs
2+
processors:
3+
- grok:
4+
field: message
5+
patterns:
6+
- '\[%{TIMESTAMP:icinga.main.timestamp}\] %{WORD:log.level}/%{WORD:icinga.main.facility}:
7+
%{GREEDYMULTILINE:message}'
8+
ignore_missing: true
9+
pattern_definitions:
10+
TIMESTAMP: '%{YEAR}-%{MONTHNUM}-%{MONTHDAY} %{HOUR}:%{MINUTE}:%{SECOND} %{ISO8601_TIMEZONE}'
11+
GREEDYMULTILINE: |-
12+
(.|
13+
)*
14+
- date:
15+
field: icinga.main.timestamp
16+
target_field: '@timestamp'
17+
formats:
18+
- yyyy-MM-dd HH:mm:ss Z
19+
ignore_failure: true
20+
- remove:
21+
field: icinga.main.timestamp
22+
- set:
23+
field: event.kind
24+
value: event
25+
- script:
26+
lang: painless
27+
source: >-
28+
def errorLevels = ["warning", "critical"];
29+
if (ctx?.log?.level != null) {
30+
if (errorLevels.contains(ctx.log.level)) {
31+
ctx.event.type = "error";
32+
} else {
33+
ctx.event.type = "info";
34+
}
35+
}
36+
on_failure:
37+
- set:
38+
field: error.message
39+
value: '{{ _ingest.on_failure_message }}'

filebeat/module/icinga/main/manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ var:
99
os.windows:
1010
- c:/programdata/icinga2/var/log/icinga2/icinga2.log*
1111

12-
ingest_pipeline: ingest/pipeline.json
12+
ingest_pipeline: ingest/pipeline.yml
1313
input: config/main.yml

filebeat/module/icinga/main/test/test.log-expected.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
{
33
"@timestamp": "2017-04-04T09:16:34.000Z",
44
"event.dataset": "icinga.main",
5+
"event.kind": "event",
56
"event.module": "icinga",
7+
"event.type": "info",
68
"fileset.name": "main",
79
"icinga.main.facility": "Notification",
810
"input.type": "log",
@@ -14,7 +16,9 @@
1416
{
1517
"@timestamp": "2017-04-04T09:16:34.000Z",
1618
"event.dataset": "icinga.main",
19+
"event.kind": "event",
1720
"event.module": "icinga",
21+
"event.type": "error",
1822
"fileset.name": "main",
1923
"icinga.main.facility": "PluginNotificationTask",
2024
"input.type": "log",
@@ -29,7 +33,9 @@
2933
{
3034
"@timestamp": "2017-04-04T09:16:48.000Z",
3135
"event.dataset": "icinga.main",
36+
"event.kind": "event",
3237
"event.module": "icinga",
38+
"event.type": "info",
3339
"fileset.name": "main",
3440
"icinga.main.facility": "IdoMysqlConnection",
3541
"input.type": "log",

filebeat/module/icinga/startup/ingest/pipeline.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)