Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Filebeat] Improve ECS field mappings in santa module #17982

Merged
merged 3 commits into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d

*Filebeat*
- Improve ECS field mappings in panw module. event.outcome now only contains success/failure per ECS specification. {issue}16025[16025] {pull}17910[17910]
- Improve ECS field mappings in santa module. move hash.sha256 to process.hash.sha256 & move certificate fields to santa.certificate . {issue}16180[16180] {pull}17982[17982]

*Heartbeat*

Expand Down
4 changes: 2 additions & 2 deletions filebeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -28696,7 +28696,7 @@ The disk volume path.

--

*`certificate.common_name`*::
*`santa.certificate.common_name`*::
+
--
Common name from code signing certificate.
Expand All @@ -28705,7 +28705,7 @@ type: keyword

--

*`certificate.sha256`*::
*`santa.certificate.sha256`*::
+
--
SHA256 hash of code signing certificate.
Expand Down
12 changes: 6 additions & 6 deletions filebeat/module/santa/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@
- name: mount
description: The disk volume path.

- name: certificate.common_name
type: keyword
description: Common name from code signing certificate.
- name: certificate.common_name
type: keyword
description: Common name from code signing certificate.

- name: certificate.sha256
type: keyword
description: SHA256 hash of code signing certificate.
- name: certificate.sha256
type: keyword
description: SHA256 hash of code signing certificate.
2 changes: 1 addition & 1 deletion filebeat/module/santa/fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 0 additions & 71 deletions filebeat/module/santa/log/ingest/pipeline.json

This file was deleted.

91 changes: 91 additions & 0 deletions filebeat/module/santa/log/ingest/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
description: Pipeline for parsing Google Santa logs.
processors:
- grok:
field: message
patterns:
- '\[%{TIMESTAMP_ISO8601:process.start}\] %{NOT_SEPARATOR:log.level} santad: action=%{NOT_SEPARATOR:santa.action}\|decision=%{NOT_SEPARATOR:santa.decision}\|reason=%{NOT_SEPARATOR:santa.reason}\|sha256=%{NOT_SEPARATOR:process.hash.sha256}\|path=%{NOT_SEPARATOR:process.executable}(\|args=%{NOT_SEPARATOR:santa.args})?(\|cert_sha256=%{NOT_SEPARATOR:santa.certificate.sha256})?(\|cert_cn=%{NOT_SEPARATOR:santa.certificate.common_name})?\|pid=%{NUMBER:process.pid:long}\|ppid=%{NUMBER:process.ppid:long}\|uid=%{NUMBER:user.id}\|user=%{NOT_SEPARATOR:user.name}\|gid=%{NUMBER:group.id}\|group=%{NOT_SEPARATOR:group.name}\|mode=%{WORD:santa.mode}'
- '\[%{TIMESTAMP_ISO8601:timestamp}\] %{NOT_SEPARATOR:log.level} santad: action=%{NOT_SEPARATOR:santa.action}\|mount=%{NOT_SEPARATOR:santa.disk.mount}\|volume=%{NOT_SEPARATOR:santa.disk.volume}\|bsdname=%{NOT_SEPARATOR:santa.disk.bsdname}\|fs=%{NOT_SEPARATOR:santa.disk.fs}\|model=%{NOT_SEPARATOR:santa.disk.model}\|serial=%{NOT_SEPARATOR:santa.disk.serial}\|bus=%{NOT_SEPARATOR:santa.disk.bus}\|dmgpath=%{NOT_SEPARATOR:santa.disk.dmgpath}?'
pattern_definitions:
NOT_SEPARATOR: '[^\|]+'
- rename:
field: message
target_field: log.original
- date:
field: process.start
target_field: process.start
formats:
- ISO8601
ignore_failure: true
- set:
field: '@timestamp'
value: '{{ process.start }}'
ignore_failure: true
- split:
field: santa.args
separator: ' '
ignore_failure: true
- date:
field: timestamp
target_field: '@timestamp'
formats:
- ISO8601
ignore_failure: true
- remove:
field: timestamp
ignore_missing: true
- append:
field: process.args
value: "{{process.executable}}"
if: "ctx?.process?.executable != null"
- foreach:
field: santa.args
processor:
append:
field: process.args
value: "{{_ingest._value}}"
ignore_missing: true
- remove:
field: santa.args
ignore_missing: true
- set:
field: event.kind
value: event
- append:
field: event.category
value: process
if: "ctx?.santa?.action == 'EXEC'"
- append:
field: event.type
value: start
if: "ctx?.santa?.action == 'EXEC'"
- set:
field: event.outcome
value: success
if: "ctx?.santa?.decision == 'ALLOW'"
- set:
field: event.outcome
value: failure
if: "ctx?.santa?.decision == 'DENY'"
- set:
field: event.action
value: "{{santa.action}}"
if: "ctx?.santa?.action != null"
- lowercase:
field: event.action
ignore_missing: true
- append:
field: related.user
value: "{{user.name}}"
if: "ctx?.user?.name != null"
- append:
field: related.hash
value: "{{santa.certificate.sha256}}"
if: "ctx?.santa?.certificate?.sha256 != null"
- append:
field: related.hash
value: "{{process.hash.sha256}}"
if: "ctx?.process?.hash != null"
on_failure:
- set:
field: error.message
value: '{{ _ingest.on_failure_message }}'
2 changes: 1 addition & 1 deletion filebeat/module/santa/log/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ var:
- name: input
andrewkroh marked this conversation as resolved.
Show resolved Hide resolved
default: file

ingest_pipeline: ingest/pipeline.json
ingest_pipeline: ingest/pipeline.yml
input: config/{{.input}}.yml
Loading