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

Support multiline logs in logstash/log fileset of Filebeat #8562

Merged
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
4 changes: 4 additions & 0 deletions filebeat/module/logstash/log/config/log.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ paths:
- {{$path}}
{{ end }}
exclude_files: [".gz$"]
multiline:
pattern: ^\[[0-9]{4}-[0-9]{2}-[0-9]{2}
negate: true
match: after
5 changes: 3 additions & 2 deletions filebeat/module/logstash/log/ingest/pipeline-plain.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
"field": "message",
"pattern_definitions": {
"LOGSTASH_CLASS_MODULE": "[\\w\\.]+\\s*",
"LOGSTASH_LOGLEVEL": "INFO|ERROR|DEBUG|FATAL|WARN|TRACE"
"LOGSTASH_LOGLEVEL": "INFO|ERROR|DEBUG|FATAL|WARN|TRACE",
"GREEDYMULTILINE" : "(.|\n)*"
},
"patterns": [
"\\[%{TIMESTAMP_ISO8601:logstash.log.timestamp}\\]\\[%{LOGSTASH_LOGLEVEL:logstash.log.level}\\s?\\]\\[%{LOGSTASH_CLASS_MODULE:logstash.log.module}\\] %{GREEDYDATA:logstash.log.message}"
"\\[%{TIMESTAMP_ISO8601:logstash.log.timestamp}\\]\\[%{LOGSTASH_LOGLEVEL:logstash.log.level}\\s?\\]\\[%{LOGSTASH_CLASS_MODULE:logstash.log.module}\\] %{GREEDYMULTILINE:logstash.log.message}"
]
}
},
Expand Down
4 changes: 4 additions & 0 deletions filebeat/module/logstash/log/test/logstash-plain.log
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
[2017-10-23T14:20:12,046][INFO ][logstash.modules.scaffold] Initializing module {:module_name=>"fb_apache", :directory=>"/usr/share/logstash/modules/fb_apache/configuration"}
[2017-11-20T03:55:00,318][INFO ][logstash.inputs.jdbc ] (0.058950s) Select Name as [person.name]
, Address as [person.address]
from people

Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,19 @@
"logstash.log.module": "logstash.modules.scaffold",
"offset": 0,
"prospector.type": "log"
},
{
"@timestamp": "2017-11-20T03:55:00,318",
"fileset.module": "logstash",
"fileset.name": "log",
"input.type": "log",
"log.flags": [
"multiline"
],
"logstash.log.level": "INFO",
"logstash.log.message": "(0.058950s) Select Name as [person.name]\n, Address as [person.address]\nfrom people\n",
"logstash.log.module": "logstash.inputs.jdbc ",
"offset": 175,
"prospector.type": "log"
}
]