<?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: Rex with optional end of message in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Rex-with-optional-end-of-message/m-p/130607#M35611</link>
    <description>&lt;P&gt;Ah yeah, adding the end-of-line anchor is necessary.&lt;/P&gt;</description>
    <pubDate>Thu, 18 Sep 2014 17:03:09 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2014-09-18T17:03:09Z</dc:date>
    <item>
      <title>Rex with optional end of message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-with-optional-end-of-message/m-p/130600#M35604</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I have a log like that :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2014-29-08 08:28:45,817.366  - INFO - message1
2014-29-08 08:28:45,817.366  - WARN - message2 ID = 458315
2014-29-08 08:28:45,817.366  - DEBUG- message3 ID = 8
2014-29-08 08:28:45,817.366  - INFO - message4
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to extract message1, message2, message3 and message4 in the same field "App_message".&lt;/P&gt;

&lt;P&gt;I try this but it's not working :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex "\s-\s+(?&amp;lt;App_level&amp;gt;[A-Z]+)\s*-\s+(?&amp;lt;App_message&amp;gt;.+)(?:ID\s=\s[0-9]+)?"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Help pls &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Sep 2014 14:15:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-with-optional-end-of-message/m-p/130600#M35604</guid>
      <dc:creator>splunksogetiht</dc:creator>
      <dc:date>2014-09-18T14:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: Rex with optional end of message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-with-optional-end-of-message/m-p/130601#M35605</link>
      <description>&lt;P&gt;Replacing&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?&amp;lt;App_message&amp;gt;.+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;with&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?&amp;lt;App_message&amp;gt;\w+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;should help.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Sep 2014 14:20:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-with-optional-end-of-message/m-p/130601#M35605</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2014-09-18T14:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: Rex with optional end of message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-with-optional-end-of-message/m-p/130602#M35606</link>
      <description>&lt;P&gt;But "App_message" can contain many caracters and not only alphanumeric :&lt;BR /&gt;
     ( : ; - \ [ " ' $ ....&lt;/P&gt;</description>
      <pubDate>Thu, 18 Sep 2014 14:27:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-with-optional-end-of-message/m-p/130602#M35606</guid>
      <dc:creator>splunksogetiht</dc:creator>
      <dc:date>2014-09-18T14:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: Rex with optional end of message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-with-optional-end-of-message/m-p/130603#M35607</link>
      <description>&lt;P&gt;Assuming the message actually is longer than just a word, you can do this based off your original regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; rex "\s-\s+(?&amp;lt;App_level&amp;gt;[A-Z]+)\s*-\s+(?&amp;lt;App_message&amp;gt;.+?)(?:\s*ID\s=\s[0-9]+)?"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;All I did was make the &lt;CODE&gt;.+&lt;/CODE&gt; non-greedy and added a &lt;CODE&gt;\s*&lt;/CODE&gt; to the start of the optional end.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Sep 2014 14:27:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-with-optional-end-of-message/m-p/130603#M35607</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-09-18T14:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: Rex with optional end of message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-with-optional-end-of-message/m-p/130604#M35608</link>
      <description>&lt;P&gt;The message can be something like :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cCMSyncManager::LCRRerunperARNThread::Send ABDCng Requestfor ARN = F-WWTF, with TransactionID = 1857182350
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cCMSyncManager::UpdateDatabaseThreshold::Data is pushed for deleting ARN::F-WWTF, TLM = WIREDand StreamID = 12
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I just want extract the message without the "ID= ..." sequence.&lt;/P&gt;

&lt;P&gt;I did a mistake in my original post : there is no space between "App_message" and the "ID = ..."&lt;/P&gt;</description>
      <pubDate>Thu, 18 Sep 2014 14:39:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-with-optional-end-of-message/m-p/130604#M35608</guid>
      <dc:creator>splunksogetiht</dc:creator>
      <dc:date>2014-09-18T14:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Rex with optional end of message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-with-optional-end-of-message/m-p/130605#M35609</link>
      <description>&lt;P&gt;You should take @martin_mueller's rex, remove the &lt;CODE&gt;\s&lt;/CODE&gt; he added (since you've since stated it's not really there), and then instead of making the ID part optional with &lt;CODE&gt;?&lt;/CODE&gt;, make that clause something that either matches the ID part or the end of the line:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex "\s-\s+(?&amp;lt;App_level&amp;gt;[A-Z]+)\s*-\s+(?&amp;lt;App_message&amp;gt;.+?)((?:ID\s=\s\d+)|$)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Sep 2014 15:02:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-with-optional-end-of-message/m-p/130605#M35609</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2014-09-18T15:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: Rex with optional end of message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-with-optional-end-of-message/m-p/130606#M35610</link>
      <description>&lt;P&gt;Ohhhh nice, it's working now ! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Really thank you !&lt;/P&gt;</description>
      <pubDate>Thu, 18 Sep 2014 15:07:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-with-optional-end-of-message/m-p/130606#M35610</guid>
      <dc:creator>splunksogetiht</dc:creator>
      <dc:date>2014-09-18T15:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: Rex with optional end of message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-with-optional-end-of-message/m-p/130607#M35611</link>
      <description>&lt;P&gt;Ah yeah, adding the end-of-line anchor is necessary.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Sep 2014 17:03:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-with-optional-end-of-message/m-p/130607#M35611</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-09-18T17:03:09Z</dc:date>
    </item>
  </channel>
</rss>

