Count number of line in message field(multiline message field)

Hi Team,

I am trying to do thread dumb analysis using logstash. I want to read number of line available in the message filed using logstash code and create a pie chart based on line count.

Please let me know how to count lines.

Thanks in Advance.

Count the number of newlines and add 1. No fancy escaping schemes in logstash, just embed a literal newline in the string...

    ruby { code => 'event.set("numLines", 1 + event.get("message").count("
"))' }

Thanks . It worked.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.