<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to parse multi-line mixed messages from rsyslog? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-multi-line-mixed-messages-from-rsyslog/m-p/350499#M64330</link>
    <description>&lt;P&gt;Recently a college asked me the same thing; how he could handle stack traces in multi-line events.&lt;/P&gt;

&lt;P&gt;Stack traces usually have the same format - where the following lines are starting with something like "[...] caused by. [..]",&lt;BR /&gt;
so I would write a RegEx which does a BREAK_ONLY_BEFORE. After that , you simply define a) your RegEx &lt;EM&gt;and&lt;/EM&gt; b) an "OR" after your RegEx to do the event breaking after a new line feed (\n), something like this (just an example):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;((?=stacktraceline|\n)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Just add a stanza with your sourcetype in your transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[your_sourcetype]
SHOULD_LINEMERGE = true
BREAK_ONLY_BEFORE = ((?=stacktraceline\d)|\n)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Skalli&lt;/P&gt;

&lt;P&gt;edit: typo&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 16:45:20 GMT</pubDate>
    <dc:creator>skalliger</dc:creator>
    <dc:date>2020-09-29T16:45:20Z</dc:date>
    <item>
      <title>How to parse multi-line mixed messages from rsyslog?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-multi-line-mixed-messages-from-rsyslog/m-p/350497#M64328</link>
      <description>&lt;P&gt;How to parse multi-line mixed messages from rsyslog?&lt;BR /&gt;
There are a lot of data from lot of applications comming from Docker with syslog driver. All of these applications have proper syslog tag. Problem is that I cannot touch application code (Java). .... problem is multi-line stacktraces, these are flushed to docker stdout line by line. It means that rsyslog handle these lines as seperate messages.&lt;/P&gt;

&lt;P&gt;I have tcp monitor in inputs.conf&lt;/P&gt;

&lt;P&gt;What i see in splunk is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;$pri&amp;gt;  $timestamp $host $syslogtag[$process]  $app_payload_msg
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So for example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;1&amp;gt; 2017-11-03T08:30:55.311256+01:00 myhost firstapp[1] 2017-11-03 08:31:55.31,301 ERROR  [myclass] Stacktrace1
&amp;lt;1&amp;gt; 2017-11-03T08:31:55.313649+01:00 myhost secondapp[1] 2017-11-03 08:31:55.31,301 WARN [myclass] message
&amp;lt;1&amp;gt; 2017-11-03T08:32:55.311256+01:00 myhost firstapp[1]      stacktraceline2
&amp;lt;1&amp;gt; 2017-11-03T08:33:55.311256+01:00 myhost firstapp[1]      stacktraceline3
&amp;lt;1&amp;gt; 2017-11-03T08:34:55.313649+01:00 myhost thirdapp[1] 2017-11-03 08:34:55.31,301 INFO [myclass] message
&amp;lt;1&amp;gt; 2017-11-03T08:35:55.311256+01:00 myhost firstapp[1]      stacktraceline4
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want these separate messsages group to events like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;1&amp;gt; 2017-11-03T08:30:55.311256+01:00 myhost firstapp[1] 2017-11-03 08:31:55.31,301 ERROR  [myclass] Stacktrace1
                             stacktraceline2
                             stacktraceline3
                             stacktraceline4
 &amp;lt;1&amp;gt; 2017-11-03T08:31:55.313649+01:00 myhost secondapp[1] 2017-11-03 08:31:55.31,301 WARN [myclass] message
 &amp;lt;1&amp;gt; 2017-11-03T08:34:55.313649+01:00 myhost thirdapp[1] 2017-11-03 08:34:55.31,301 INFO [myclass] message
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2017 08:36:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-multi-line-mixed-messages-from-rsyslog/m-p/350497#M64328</guid>
      <dc:creator>Rialf1959</dc:creator>
      <dc:date>2017-11-03T08:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse multi-line mixed messages from rsyslog?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-multi-line-mixed-messages-from-rsyslog/m-p/350498#M64329</link>
      <description>&lt;P&gt;Not an answer on your question, but an alternative, we have build a collector and Monitoring Docker application, which handles multiline events as well. Certified Splunk application &lt;A href="https://splunkbase.splunk.com/app/3723/"&gt;https://splunkbase.splunk.com/app/3723/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 03:08:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-multi-line-mixed-messages-from-rsyslog/m-p/350498#M64329</guid>
      <dc:creator>outcoldman</dc:creator>
      <dc:date>2017-11-10T03:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse multi-line mixed messages from rsyslog?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-multi-line-mixed-messages-from-rsyslog/m-p/350499#M64330</link>
      <description>&lt;P&gt;Recently a college asked me the same thing; how he could handle stack traces in multi-line events.&lt;/P&gt;

&lt;P&gt;Stack traces usually have the same format - where the following lines are starting with something like "[...] caused by. [..]",&lt;BR /&gt;
so I would write a RegEx which does a BREAK_ONLY_BEFORE. After that , you simply define a) your RegEx &lt;EM&gt;and&lt;/EM&gt; b) an "OR" after your RegEx to do the event breaking after a new line feed (\n), something like this (just an example):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;((?=stacktraceline|\n)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Just add a stanza with your sourcetype in your transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[your_sourcetype]
SHOULD_LINEMERGE = true
BREAK_ONLY_BEFORE = ((?=stacktraceline\d)|\n)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Skalli&lt;/P&gt;

&lt;P&gt;edit: typo&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:45:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-multi-line-mixed-messages-from-rsyslog/m-p/350499#M64330</guid>
      <dc:creator>skalliger</dc:creator>
      <dc:date>2020-09-29T16:45:20Z</dc:date>
    </item>
  </channel>
</rss>

