forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Filebeat] Add module for Kibana audit logs (elastic#22696)
Co-authored-by: Thom Heymann <190132+thomheymann@users.noreply.github.com>
- Loading branch information
1 parent
6fe33bb
commit e3a9911
Showing
16 changed files
with
472 additions
and
5 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
@@ -1,8 +1,16 @@ | ||
- module: kibana | ||
# All logs | ||
# Server logs | ||
log: | ||
enabled: true | ||
|
||
# Set custom paths for the log files. If left empty, | ||
# Filebeat will choose the paths depending on your OS. | ||
#var.paths: | ||
|
||
# Audit logs | ||
audit: | ||
enabled: true | ||
|
||
# Set custom paths for the log files. If left empty, | ||
# Filebeat will choose the paths depending on your OS. | ||
#var.paths: |
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
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,16 @@ | ||
type: log | ||
paths: | ||
{{ range $i, $path := .paths }} | ||
- {{$path}} | ||
{{ end }} | ||
exclude_files: [".gz$"] | ||
|
||
processors: | ||
- add_locale: ~ | ||
- add_fields: | ||
target: '' | ||
fields: | ||
ecs.version: 0.0.0 | ||
- decode_json_fields: | ||
fields: [message] | ||
target: kibana._audit_temp |
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,106 @@ | ||
description: Pipeline for parsing Kibana audit logs in JSON format | ||
processors: | ||
|
||
- set: | ||
field: "@timestamp" | ||
value: "{{kibana._audit_temp.@timestamp}}" | ||
|
||
- set: | ||
field: message | ||
value: "{{kibana._audit_temp.message}}" | ||
|
||
- set: | ||
if: ctx.kibana._audit_temp.event.action != null | ||
field: event.action | ||
value: "{{kibana._audit_temp.event.action}}" | ||
- set: | ||
if: ctx.kibana._audit_temp.event.category != null | ||
field: event.category | ||
value: "{{kibana._audit_temp.event.category}}" | ||
- set: | ||
if: ctx.kibana._audit_temp.event.outcome != null | ||
field: event.outcome | ||
value: "{{kibana._audit_temp.event.outcome}}" | ||
- set: | ||
if: ctx.kibana._audit_temp.event.type != null | ||
field: event.type | ||
value: "{{kibana._audit_temp.event.type}}" | ||
|
||
- remove: | ||
field: 'ecs' | ||
- rename: | ||
if: ctx.kibana._audit_temp.ecs != null | ||
field: kibana._audit_temp.ecs | ||
target_field: "ecs" | ||
|
||
- rename: | ||
if: ctx.kibana._audit_temp.url != null | ||
field: kibana._audit_temp.url | ||
target_field: "url" | ||
|
||
- set: | ||
if: ctx.url?.query == null | ||
field: url.original | ||
value: '{{url.path}}' | ||
ignore_empty_value: true | ||
- set: | ||
if: ctx.url?.path != null && ctx.url?.query != null | ||
field: url.original | ||
value: '{{url.path}}?{{url.query}}' | ||
|
||
- rename: | ||
if: ctx.kibana._audit_temp.http != null | ||
field: kibana._audit_temp.http | ||
target_field: http | ||
|
||
- rename: | ||
if: ctx.kibana._audit_temp.user != null | ||
field: kibana._audit_temp.user | ||
target_field: user | ||
|
||
- rename: | ||
if: ctx.kibana._audit_temp.trace != null | ||
field: kibana._audit_temp.trace | ||
target_field: trace | ||
|
||
- rename: | ||
if: ctx.kibana._audit_temp.process?.pid != null | ||
target_field: process | ||
field: kibana._audit_temp.process | ||
|
||
- rename: | ||
if: ctx.kibana._audit_temp.error != null | ||
target_field: error | ||
field: kibana._audit_temp.error | ||
|
||
- rename: | ||
if: ctx.kibana._audit_temp.kibana.session_id != null | ||
target_field: kibana.session_id | ||
field: kibana._audit_temp.kibana.session_id | ||
|
||
- rename: | ||
if: ctx.kibana._audit_temp.kibana.space_id != null | ||
target_field: kibana.space_id | ||
field: kibana._audit_temp.kibana.space_id | ||
|
||
- rename: | ||
if: ctx.kibana._audit_temp.kibana.saved_object != null | ||
target_field: kibana.saved_object | ||
field: kibana._audit_temp.kibana.saved_object | ||
|
||
- rename: | ||
if: ctx.kibana._audit_temp.kibana.add_to_spaces != null | ||
target_field: kibana.add_to_spaces | ||
field: kibana._audit_temp.kibana.add_to_spaces | ||
|
||
- rename: | ||
if: ctx.kibana._audit_temp.kibana.delete_from_spaces != null | ||
target_field: kibana.delete_from_spaces | ||
field: kibana._audit_temp.kibana.delete_from_spaces | ||
|
||
- remove: | ||
field: 'kibana._audit_temp' | ||
on_failure: | ||
- set: | ||
field: error.message | ||
value: '{{ _ingest.on_failure_message }}' |
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,21 @@ | ||
description: Pipeline for parsing Kibana audit logs | ||
processors: | ||
- set: | ||
field: event.ingested | ||
value: '{{_ingest.timestamp}}' | ||
- rename: | ||
field: '@timestamp' | ||
target_field: event.created | ||
- pipeline: | ||
name: '{< IngestPipeline "pipeline-json" >}' | ||
- set: | ||
field: event.kind | ||
value: event | ||
- append: | ||
field: related.user | ||
value: "{{user.name}}" | ||
if: "ctx?.user?.name != null" | ||
on_failure: | ||
- set: | ||
field: error.message | ||
value: '{{ _ingest.on_failure_message }}' |
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,12 @@ | ||
module_version: 1.0 | ||
|
||
var: | ||
- name: paths | ||
default: | ||
- /var/log/kibana/*_audit.json | ||
|
||
ingest_pipeline: | ||
- ingest/pipeline.yml | ||
- ingest/pipeline-json.yml | ||
|
||
input: config/audit.yml |
Oops, something went wrong.