ssasporta
(Sharon Sasporta)
February 8, 2018, 8:58am
1
Hi,
I am trying to split the message where ever a new line exist by ruby filter .
The command in the ruby code I use:
message_array = event.get('message').split("\n")
But the logstash doesn't start because of it.
It looks like logstash doesn't support the "\n"
message_array = event.get('message').split(\""}
Any workaround?
Regards,
Sharon.
Don't mix single and double quotes inside the Ruby code. You can't use the same kind of quote that you're using the delimit the Ruby code block.
ssasporta
(Sharon Sasporta)
February 8, 2018, 1:02pm
3
Sure, great.
So what should I do?
What do I need to do in order to split the event in new lines?
Thanks in advanced,
Sharon.
As I said, use quotes consistently.
code => 'message_array = event.get("message").split("\n")'
Of course, to just split a string on newline characters you don't need a ruby filter, just use a mutate filter.
system
(system)
Closed
March 8, 2018, 1:11pm
6
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.