-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy log.syslog.appname to process.name (#10646)
* Copy log.syslog.appname to process.name Before the syslog processor was added to the default filebeat yaml configuration, process.name was set by a Grok ingest pipeline. However, when the syslog processor was added a condition was also added to the Grok ingest pipeline, `if: ctx.log?.syslog == null`. This condition always evaluates to false when the data is supplied by the syslog processor, and therefore `process.name` is not extraced from the syslog message. This commit copies the process name from `log.syslog.appname` to `process.name` before an pipeline processors which use it are executed. With this change, `process.name`, `event.category`, and `event.type` are now populated when data arrives from the syslog processor.
- Loading branch information
1 parent
70dba98
commit 8107f32
Showing
6 changed files
with
356 additions
and
2 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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
144 changes: 144 additions & 0 deletions
144
packages/system/data_stream/auth/_dev/test/pipeline/test-host-syslog-processor.json
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,144 @@ | ||
{ | ||
"events": [ | ||
{ | ||
"event" : { | ||
"original": "<165>1 2022-01-11T22:14:15.003Z mymachine.example.com eventslog 1024 ID47 [exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"][examplePriority@32473 class=\"high\"] this is the message" | ||
}, | ||
"@timestamp": "2022-01-11T22:14:15.003Z", | ||
"log": { | ||
"syslog": { | ||
"priority": 165, | ||
"facility": { | ||
"code": 20, | ||
"name": "local4" | ||
}, | ||
"severity": { | ||
"code": 5, | ||
"name": "Notice" | ||
}, | ||
"hostname": "mymachine.example.com", | ||
"appname": "eventslog", | ||
"procid": "1024", | ||
"msgid": "ID47", | ||
"version": "1", | ||
"structured_data": { | ||
"exampleSDID@32473": { | ||
"iut": "3", | ||
"eventSource": "Application", | ||
"eventID": "1011" | ||
}, | ||
"examplePriority@32473": { | ||
"class": "high" | ||
} | ||
} | ||
} | ||
}, | ||
"message": "this is the message" | ||
}, | ||
{ | ||
"@timestamp": "2022-01-11T22:14:15.003Z", | ||
"event" : { | ||
"original": "<165>1 2022-01-11T22:14:15.003Z mymachine.example.com groupadd 1024 ID47 [exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"][examplePriority@32473 class=\"high\"] this is the message" | ||
}, | ||
"log": { | ||
"syslog": { | ||
"priority": 165, | ||
"facility": { | ||
"code": 20, | ||
"name": "local4" | ||
}, | ||
"severity": { | ||
"code": 5, | ||
"name": "Notice" | ||
}, | ||
"hostname": "mymachine.example.com", | ||
"appname": "groupdel", | ||
"procid": "1024", | ||
"msgid": "ID47", | ||
"version": "1", | ||
"structured_data": { | ||
"exampleSDID@32473": { | ||
"iut": "3", | ||
"eventSource": "Application", | ||
"eventID": "1011" | ||
}, | ||
"examplePriority@32473": { | ||
"class": "high" | ||
} | ||
} | ||
} | ||
}, | ||
"message": "this is the message" | ||
}, | ||
{ | ||
"@timestamp": "2022-01-11T22:14:15.003Z", | ||
"event" : { | ||
"original": "<165>1 2022-01-11T22:14:15.003Z mymachine.example.com useradd 1024 ID47 [exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"][examplePriority@32473 class=\"high\"] this is the message" | ||
}, | ||
"log": { | ||
"syslog": { | ||
"priority": 165, | ||
"facility": { | ||
"code": 20, | ||
"name": "local4" | ||
}, | ||
"severity": { | ||
"code": 5, | ||
"name": "Notice" | ||
}, | ||
"hostname": "mymachine.example.com", | ||
"appname": "useradd", | ||
"procid": "1024", | ||
"msgid": "ID47", | ||
"version": "1", | ||
"structured_data": { | ||
"exampleSDID@32473": { | ||
"iut": "3", | ||
"eventSource": "Application", | ||
"eventID": "1011" | ||
}, | ||
"examplePriority@32473": { | ||
"class": "high" | ||
} | ||
} | ||
} | ||
}, | ||
"message": "this is the message" | ||
}, | ||
{ | ||
"@timestamp": "2022-01-11T22:14:15.003Z", | ||
"event" : { | ||
"original": "<165>1 2022-01-11T22:14:15.003Z mymachine.example.com usermod 1024 ID47 [exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"][examplePriority@32473 class=\"high\"] this is the message" | ||
}, | ||
"log": { | ||
"syslog": { | ||
"priority": 165, | ||
"facility": { | ||
"code": 20, | ||
"name": "local4" | ||
}, | ||
"severity": { | ||
"code": 5, | ||
"name": "Notice" | ||
}, | ||
"hostname": "mymachine.example.com", | ||
"appname": "usermod", | ||
"procid": "1024", | ||
"msgid": "ID47", | ||
"version": "1", | ||
"structured_data": { | ||
"exampleSDID@32473": { | ||
"iut": "3", | ||
"eventSource": "Application", | ||
"eventID": "1011" | ||
}, | ||
"examplePriority@32473": { | ||
"class": "high" | ||
} | ||
} | ||
} | ||
}, | ||
"message": "this is the message" | ||
} | ||
] | ||
} |
199 changes: 199 additions & 0 deletions
199
.../system/data_stream/auth/_dev/test/pipeline/test-host-syslog-processor.json-expected.json
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,199 @@ | ||
{ | ||
"expected": [ | ||
{ | ||
"@timestamp": "2022-01-11T22:14:15.003Z", | ||
"ecs": { | ||
"version": "8.11.0" | ||
}, | ||
"event": { | ||
"kind": "event" | ||
}, | ||
"log": { | ||
"syslog": { | ||
"priority": 30, | ||
"appname": "eventslog", | ||
"facility": { | ||
"code": 20, | ||
"name": "local4" | ||
}, | ||
"hostname": "mymachine.example.com", | ||
"msgid": "ID47", | ||
"priority": 165, | ||
"procid": "1024", | ||
"severity": { | ||
"code": 5, | ||
"name": "Notice" | ||
}, | ||
"structured_data": { | ||
"examplePriority@32473": { | ||
"class": "high" | ||
}, | ||
"exampleSDID@32473": { | ||
"eventID": "1011", | ||
"eventSource": "Application", | ||
"iut": "3" | ||
} | ||
}, | ||
"version": "1" | ||
} | ||
}, | ||
"message": "this is the message", | ||
"process": { | ||
"name": "eventslog" | ||
} | ||
}, | ||
{ | ||
"@timestamp": "2022-01-11T22:14:15.003Z", | ||
"ecs": { | ||
"version": "8.11.0" | ||
}, | ||
"event": { | ||
"kind": "event", | ||
"category": [ | ||
"iam" | ||
], | ||
"kind": "event", | ||
"outcome": "success", | ||
"type": [ | ||
"group", | ||
"deletion" | ||
] | ||
}, | ||
"log": { | ||
"syslog": { | ||
"priority": 30, | ||
"appname": "groupdel", | ||
"facility": { | ||
"code": 20, | ||
"name": "local4" | ||
}, | ||
"hostname": "mymachine.example.com", | ||
"msgid": "ID47", | ||
"priority": 165, | ||
"procid": "1024", | ||
"severity": { | ||
"code": 5, | ||
"name": "Notice" | ||
}, | ||
"structured_data": { | ||
"examplePriority@32473": { | ||
"class": "high" | ||
}, | ||
"exampleSDID@32473": { | ||
"eventID": "1011", | ||
"eventSource": "Application", | ||
"iut": "3" | ||
} | ||
}, | ||
"version": "1" | ||
} | ||
}, | ||
"message": "this is the message", | ||
"process": { | ||
"name": "groupdel" | ||
} | ||
}, | ||
{ | ||
"@timestamp": "2022-01-11T22:14:15.003Z", | ||
"ecs": { | ||
"version": "8.11.0" | ||
}, | ||
"event": { | ||
"kind": "event", | ||
"category": [ | ||
"iam" | ||
], | ||
"kind": "event", | ||
"outcome": "success", | ||
"type": [ | ||
"user", | ||
"creation" | ||
] | ||
}, | ||
"log": { | ||
"syslog": { | ||
"priority": 30, | ||
"appname": "useradd", | ||
"facility": { | ||
"code": 20, | ||
"name": "local4" | ||
}, | ||
"hostname": "mymachine.example.com", | ||
"msgid": "ID47", | ||
"priority": 165, | ||
"procid": "1024", | ||
"severity": { | ||
"code": 5, | ||
"name": "Notice" | ||
}, | ||
"structured_data": { | ||
"examplePriority@32473": { | ||
"class": "high" | ||
}, | ||
"exampleSDID@32473": { | ||
"eventID": "1011", | ||
"eventSource": "Application", | ||
"iut": "3" | ||
} | ||
}, | ||
"version": "1" | ||
} | ||
}, | ||
"message": "this is the message", | ||
"process": { | ||
"name": "useradd" | ||
} | ||
}, | ||
{ | ||
"@timestamp": "2022-01-11T22:14:15.003Z", | ||
"ecs": { | ||
"version": "8.11.0" | ||
}, | ||
"event": { | ||
"kind": "event", | ||
"category": [ | ||
"iam" | ||
], | ||
"kind": "event", | ||
"outcome": "success", | ||
"type": [ | ||
"user", | ||
"change" | ||
] | ||
}, | ||
"log": { | ||
"syslog": { | ||
"priority": 30, | ||
"appname": "usermod", | ||
"facility": { | ||
"code": 20, | ||
"name": "local4" | ||
}, | ||
"hostname": "mymachine.example.com", | ||
"msgid": "ID47", | ||
"priority": 165, | ||
"procid": "1024", | ||
"severity": { | ||
"code": 5, | ||
"name": "Notice" | ||
}, | ||
"structured_data": { | ||
"examplePriority@32473": { | ||
"class": "high" | ||
}, | ||
"exampleSDID@32473": { | ||
"eventID": "1011", | ||
"eventSource": "Application", | ||
"iut": "3" | ||
} | ||
}, | ||
"version": "1" | ||
} | ||
}, | ||
"message": "this is the message", | ||
"process": { | ||
"name": "usermod" | ||
} | ||
} | ||
] | ||
} |
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