Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fluentd read jetty log with multiple lines

im trying to read multiple lines of a jetty log, for a source does anyone now how to do it?

<source>
type tail
format multiline
format_firstline /^\[/
format1 /^\[[^ ]* (?<time>[^\]]*)\] *(?<level>[^ ]*) $/
path /mnt/current/log/jettylog4j.log
pos_file /mnt/current/log/fluentd.jettylog4j.pos
read_from_head true
tag jettylog
refresh_interval 30
</source>

With this I don't manage to have the messages with all the lines.

like image 715
Daniel Conde Garcia Avatar asked Jul 12 '26 03:07

Daniel Conde Garcia


1 Answers

In my case I cannot change the format as is part of the legacy code. I found a pattern that works for me. I put it here in case is useful for someone

<source>
type tail
format multiline
format_firstline /^\[/
format1 /^\[[^ ]* (?<time>[^\]]*)\] *(?<level>[^ ]*) (?<message>[^\n]*(\n^[^\[].*|$))/
path /mnt/current/log/jettylog4j.log
pos_file /mnt/current/log/fluentd.jettylog4j.pos
read_from_head true
tag jettylog
refresh_interval 30
</source>
like image 64
Daniel Conde Garcia Avatar answered Jul 15 '26 03:07

Daniel Conde Garcia