Hi,
I'm trying to parse some logs from kubernetes, with docker and kubernetes metadata, inmultiline mode (works on type JSON,, but I have problem with loglines like python traceback)
I am able to parse messages logs, but when I do this, my log messagetake too much things, and take docker metadata with its...
Log line are like this :
2016-07-26 15:58:08,985 - control.hello[INFO] sync with cel...@beat.celery1
Fields are parsed, but I have in log the following :
time : 2016-07-26 15:58:08,985
pre_log control.hello
loglevel : INFO
log : sync with cel...@beat.intcelery1\n","stream":"stdout","time":"2016-07-26T13:58:08.986683043Z"}
As you can see, I have stream and time metadata which are in log message instead of be used for create the 2 fields.
Below my fluentd configuration :
<source>
@type tail
@log_level debug
path /var/log/containers/celery*.log
pos_file /tmp/es-containers_celery.log.pos
time_format %Y-%m-%d %H:%M:%S,%N
tag kubernetes.*
format multiline
multiline_flush_interval 5s
format_firstline /\[*\d{4}-\d{1,2}-\d{1,2}/
format1 /(?<time>\[*\d{4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}:\d{1,2},\d{1,3})(?::| -) (?:(?<loglevel>[A-Z]+)\/(?<process>[A-Za-z0-9-]+)\] |(?<pre_log>[a-z._]*)\[(?<log_level>[A-Z]+)\] )(?<log>(?:.|\s)*)/
read_from_head true
keep_time_key true
</source>
filter kubernetes.**>
@type kubernetes_metadata
preserve_json_log true
</filter>
<match **>
@type elasticsearch
@log_level debug
...
When I use fluentdparser or regex101 I can parse line correctly, but with metadata at the end of the line, no way to succeed.
I don't know if it is my conf or my regex which is wrong, maybe both :)
I tried to change end of regex from (?<log>(?:.|\s)*) to (?<log>.*) ; or (?<log>(?:.|\s)*)\\n\ to match newline (works great when I use regex101) , but with no success when using fluentd...