<?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 do newline splitting for a single event in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-newline-splitting-for-a-single-event/m-p/58540#M14338</link>
    <description>&lt;P&gt;pcre modifiers - &lt;A href="http://php.net/manual/en/reference.pcre.pattern.modifiers.php"&gt;http://php.net/manual/en/reference.pcre.pattern.modifiers.php&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 31 Oct 2014 23:33:58 GMT</pubDate>
    <dc:creator>jonuwz</dc:creator>
    <dc:date>2014-10-31T23:33:58Z</dc:date>
    <item>
      <title>How to do newline splitting for a single event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-newline-splitting-for-a-single-event/m-p/58535#M14333</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I want to identified the exception caused by my API to the external API. here is example, I am looking for below output&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;14 Jun 2012 07:38:55,280 [ABCD] ERROR my.classname (46) - The exception value: An error occurred while processing the request on the server: System.Runtime.Remoting.RemotingException: Server is busy. Try request again later.
at com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:188)
at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:130)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:119)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118)
at $Proxy207.retrieveDeploymentById(Unknown Source)
at com.test.abc.my(classname:46)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am looking for below output&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;14 Jun 2012 07:38:55  my.class 46  com.sun.xml.ws.fault.SOAP11Fault.getProtocolException System.Runtime.Remoting.RemotingException
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am trying below query, but not sure how can do line breaking after getting value.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search | rex "(?i)^(?P&amp;lt;DATEFIELD&amp;gt;[^,]+),\\d+\\s+\[(?P&amp;lt;FIELDNAME&amp;gt;[^ ]+)\] (?P&amp;lt;LOGTYPE&amp;gt;(INFO|ERROR|DEBUG)) (?P&amp;lt;CALLNAME&amp;gt;[^ ]+)\(\d+\)\\s-\\s(?P&amp;lt;FIELDNAME2&amp;gt;[^-]+)" | rex "(?i)\tat (?P&amp;lt;FIELDNAME3&amp;gt;[^\(]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Sumit &lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2012 00:58:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-newline-splitting-for-a-single-event/m-p/58535#M14333</guid>
      <dc:creator>sumitnagal</dc:creator>
      <dc:date>2012-09-13T00:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to do newline splitting for a single event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-newline-splitting-for-a-single-event/m-p/58536#M14334</link>
      <description>&lt;P&gt;Like this :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "(?si)^(?P&amp;lt;DATEFIELD&amp;gt;[^,]+),\d+\s+\[(?P&amp;lt;FIELDNAME&amp;gt;[^ ]+)\] (?P&amp;lt;LOGTYPE&amp;gt;(INFO|ERROR|DEBUG)) (?P&amp;lt;CALLNAME&amp;gt;[^ ]+) \((?P&amp;lt;FIELDNAME2&amp;gt;\d+)\).*?:.*?:\s+(?P&amp;lt;FIELDNAME3&amp;gt;[^:]+).*?[\r\n]+\s*at\s+(?P&amp;lt;FIELDNAME4&amp;gt;[^\(]+)" 
| table DATEFIELD FIELDNAME LOGTYPE CALLNAME FIELDNAME2 FIELDNAME3 FIELDNAME4
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The 's' in (?si) means treat \n as a character, not a line break. &lt;/P&gt;

&lt;P&gt;This returns :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;DATEFIELD   14 Jun 2012 07:38:55
FIELDNAME   ABCD
LOGTYPE     ERROR
CALLNAME    my.classname
FIELDNAME2  46
FIELDNAME3  System.Runtime.Remoting.RemotingException
FIELDNAME4  com.sun.xml.ws.fault.SOAP11Fault.getProtocolException
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Sep 2012 10:09:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-newline-splitting-for-a-single-event/m-p/58536#M14334</guid>
      <dc:creator>jonuwz</dc:creator>
      <dc:date>2012-09-13T10:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to do newline splitting for a single event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-newline-splitting-for-a-single-event/m-p/58537#M14335</link>
      <description>&lt;P&gt;This is very close to what I am looking, but I can't use FIELDNAME as it may have few lines or may have too many lines. I have to parse all the lines, please suggest how do I get specific liie , com.test.abc.my from the list of stack trace.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2013 09:48:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-newline-splitting-for-a-single-event/m-p/58537#M14335</guid>
      <dc:creator>sumitnagal</dc:creator>
      <dc:date>2013-10-07T09:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to do newline splitting for a single event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-newline-splitting-for-a-single-event/m-p/58538#M14336</link>
      <description>&lt;P&gt;Thanks!&lt;BR /&gt;
This helped me resolve an issue where a rex I used in my search would not work when I did it as a field extraction. (grabbing everything up to the end of the line) It seems as if the field extraction was applying the si, so my \n wouldn't work.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jul 2014 23:16:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-newline-splitting-for-a-single-event/m-p/58538#M14336</guid>
      <dc:creator>johnnyzebra</dc:creator>
      <dc:date>2014-07-07T23:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to do newline splitting for a single event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-newline-splitting-for-a-single-event/m-p/58539#M14337</link>
      <description>&lt;P&gt;Yes Thanks!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;The "[\r\n]" was the key I needed to search across line breaks:

| rex field=_raw "\[(?P&amp;lt;field1&amp;gt;...)\-(?P&amp;lt;field2&amp;gt;...)\-(?P&amp;lt;field3&amp;gt;...).*\]" | rex field=_raw "(?si)\s+\-\s+Caught\s+(?P&amp;lt;field4&amp;gt;...):\s+(?P&amp;lt;field5&amp;gt;...).*[\r\n](?P&amp;lt;field6&amp;gt;...):\s(?P&amp;lt;field7&amp;gt;...)" | stats count(field2) by field2,field3,field4,field5,field6,field7
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also (?m) seems to work like (?si) to tell rex to work across multiple lines:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw "\[(?P&amp;lt;field1&amp;gt;...)\-(?P&amp;lt;field2&amp;gt;...)\-(?P&amp;lt;field3&amp;gt;...).*\]" | rex field=_raw "(?m)\s+\-\s+Caught\s+(?P&amp;lt;field4&amp;gt;...):\s+(?P&amp;lt;field5&amp;gt;...).*[\r\n](?P&amp;lt;field6&amp;gt;...):\s(?P&amp;lt;field7&amp;gt;...)" | stats count(field2) by field2,field3,field4,field5,field6,field7
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there any significant difference between (?m) and (?si) ?&lt;/P&gt;

&lt;P&gt;Is this documented anywhere?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Oct 2014 23:23:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-newline-splitting-for-a-single-event/m-p/58539#M14337</guid>
      <dc:creator>wjblazek</dc:creator>
      <dc:date>2014-10-28T23:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to do newline splitting for a single event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-newline-splitting-for-a-single-event/m-p/58540#M14338</link>
      <description>&lt;P&gt;pcre modifiers - &lt;A href="http://php.net/manual/en/reference.pcre.pattern.modifiers.php"&gt;http://php.net/manual/en/reference.pcre.pattern.modifiers.php&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Oct 2014 23:33:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-newline-splitting-for-a-single-event/m-p/58540#M14338</guid>
      <dc:creator>jonuwz</dc:creator>
      <dc:date>2014-10-31T23:33:58Z</dc:date>
    </item>
  </channel>
</rss>

