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

Fixing Microsoft 365 multiline JSON logs parsing #316

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion configfiles/1001-preprocess-json.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ filter {
# this is a mess.. super annoying and prone to collateral damage
# therefore, only apply this to types where the special attention is known to be required
# maybe this is better suited to a separate pre-pre-processor? ugh...
if [type] == "gcp" or [type] == "archive-netflow" {
if [type] == "gcp" or [type] == "archive-netflow" or [type] == "microsoft365" {
if [message] =~ "},$" {
mutate {
gsub => [ "message", "},\z", "}" ]
Expand Down
10 changes: 9 additions & 1 deletion lib/filebeat_inputs/microsoft365.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,16 @@
paths:
- /logstash/microsoft365/**/*.json
close.on_state_change.inactive: 5m
exclude_lines: ['^\[$']
parsers:
- multiline:
pattern: '^{'
negate: true
match: after
max_lines: 10000000
flush_pattern: '^}'
clean_removed: true
fields_under_root: true
fields:
type: microsoft365
tags: [ 'json' ]
tags: [ 'json' ]