<?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: Extracting up to a particular string in rex in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Extracting-up-to-a-particular-string-in-rex/m-p/483093#M8621</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval Message="Automation: OS, Message: OS-001, AppName: The Outlook btnNext control not created.\" AdditionalInfo1=\"NA\" AdditionalInfo2=\"NA\"" 
| eval Message=mvindex(split(Message,"\""),0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;No, REGEX.  ( ＾∀＾)&lt;/P&gt;</description>
    <pubDate>Wed, 15 Jan 2020 17:29:47 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-01-15T17:29:47Z</dc:date>
    <item>
      <title>Extracting up to a particular string in rex</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Extracting-up-to-a-particular-string-in-rex/m-p/483088#M8616</link>
      <description>&lt;P&gt;Here's what I have.  &lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/8206i2D96A67AC2B4055C/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Basically, I'm trying to just get rid of the AddiontalInfo1 and AdditionalInfo2.  &lt;/P&gt;

&lt;P&gt;Here's the rex command I"m using:  | rex field=Message "Message=\"(?.*)"&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 17:28:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Extracting-up-to-a-particular-string-in-rex/m-p/483088#M8616</guid>
      <dc:creator>harshparikhxlrd</dc:creator>
      <dc:date>2020-01-14T17:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting up to a particular string in rex</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Extracting-up-to-a-particular-string-in-rex/m-p/483089#M8617</link>
      <description>&lt;P&gt;Your regex tells Splunk to grab everything in the Message field.  All you need to do is tell it to stop when it gets to "AdditionalInfo".&lt;/P&gt;

&lt;P&gt;Try &lt;CODE&gt;| rex field=Message "Message=\"(?&amp;lt;field&amp;gt;.*) Additional"&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 17:51:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Extracting-up-to-a-particular-string-in-rex/m-p/483089#M8617</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-01-14T17:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting up to a particular string in rex</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Extracting-up-to-a-particular-string-in-rex/m-p/483090#M8618</link>
      <description>&lt;P&gt;This may work for you:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval Message="Automation: OS, Message: OS-001, AppName: The Outlook btnNext control not created.\" AdditionalInfo1=\"NA\" AdditionalInfo2=\"NA\""
| rex field=Message "Message: (?&amp;lt;subMessage&amp;gt;.*?)\" Additional"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Jan 2020 18:37:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Extracting-up-to-a-particular-string-in-rex/m-p/483090#M8618</guid>
      <dc:creator>jpolvino</dc:creator>
      <dc:date>2020-01-14T18:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting up to a particular string in rex</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Extracting-up-to-a-particular-string-in-rex/m-p/483091#M8619</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;

&lt;P&gt;CAN YOU TRY THIS PLEASE:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval Message="Automation: OS, Message: OS-001, AppName: The Outlook btnNext control not created.\" AdditionalInfo1=\"NA\" AdditionalInfo2=\"NA\""
| rex field=Message "Message: (?&amp;lt;Message&amp;gt;.*?)\" AdditionalInfo"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Jan 2020 16:31:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Extracting-up-to-a-particular-string-in-rex/m-p/483091#M8619</guid>
      <dc:creator>TISKAR</dc:creator>
      <dc:date>2020-01-15T16:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting up to a particular string in rex</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Extracting-up-to-a-particular-string-in-rex/m-p/483092#M8620</link>
      <description>&lt;P&gt;If you know you will consistently see the pattern&lt;BR /&gt;
"Message: message is here which can include punctuation and random quotes AdditionalInfo1" then my approach would be to match on and extract what you know will always precede (Message: whitespace) and then what will be after what you want (AdditionalInfo1) to terminate the regex. Then simply extract everything between. You may need to just leave the field=Message off the rex command because that field's bounds may not be accurate.&lt;/P&gt;

&lt;P&gt;I like regex101.com for testing the regex matching&lt;/P&gt;

&lt;P&gt;Default for rex is to go against field=_raw so you don't need to specify field=Message&lt;/P&gt;

&lt;P&gt;I would specify it only if I knew that what i wanted to extract was always inside that field with no exceptions. The specificity of the rex field is mainly for performance as it limits scope. Your example event is pretty small so probably not a big deal to do _raw.&lt;/P&gt;

&lt;P&gt;Between the &amp;lt;&amp;gt; you can all the newly extracted field whatever&lt;BR /&gt;
Ignore the \'s between &amp;lt;&amp;gt;, this was how I got it to display the field name in answers&lt;BR /&gt;
You might be able to drop the escaping of : and = &lt;/P&gt;

&lt;P&gt;|rex "Message:\s(?&amp;lt;\msg_detail&amp;gt;(.*))AdditionalInfo1="&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2020 17:22:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Extracting-up-to-a-particular-string-in-rex/m-p/483092#M8620</guid>
      <dc:creator>jgbricker</dc:creator>
      <dc:date>2020-01-15T17:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting up to a particular string in rex</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Extracting-up-to-a-particular-string-in-rex/m-p/483093#M8621</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval Message="Automation: OS, Message: OS-001, AppName: The Outlook btnNext control not created.\" AdditionalInfo1=\"NA\" AdditionalInfo2=\"NA\"" 
| eval Message=mvindex(split(Message,"\""),0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;No, REGEX.  ( ＾∀＾)&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2020 17:29:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Extracting-up-to-a-particular-string-in-rex/m-p/483093#M8621</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-15T17:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting up to a particular string in rex</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Extracting-up-to-a-particular-string-in-rex/m-p/483094#M8622</link>
      <description>&lt;P&gt;This was my issue.  I also found that my other issue I had was a result of using the . operator.  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=Message "Message=\"(?&amp;lt;msg&amp;gt;[\s\S]*)\" AdditionalInfo1"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The dot operator doesn't consider spaces, which was causing an issue in my data.  Thank you though. &lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2020 21:48:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Extracting-up-to-a-particular-string-in-rex/m-p/483094#M8622</guid>
      <dc:creator>harshparikhxlrd</dc:creator>
      <dc:date>2020-01-15T21:48:21Z</dc:date>
    </item>
  </channel>
</rss>

