<?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: Can I create a substring from this string with two timestamps? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313463#M93830</link>
    <description>&lt;P&gt;@cpetterborg There are multiple different events though that have different messages like this in a "Notes" field. will the rex command still work if I just did:&lt;/P&gt;

&lt;P&gt;| makeresults | then the rex command you have?&lt;/P&gt;</description>
    <pubDate>Wed, 30 Aug 2017 17:56:27 GMT</pubDate>
    <dc:creator>kdimaria</dc:creator>
    <dc:date>2017-08-30T17:56:27Z</dc:date>
    <item>
      <title>Can I create a substring from this string with two timestamps?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313461#M93828</link>
      <description>&lt;P&gt;I was just looking up the eval substr function in splunk and was wondering if it is possible to get a substring from 0 to a character. basically I have a field that contains two times with a message: &lt;/P&gt;

&lt;P&gt;Message= hello 8/30/2017 01:32:00 GMT goodbye 8/30/2017 01:33:00 GMT &lt;/P&gt;

&lt;P&gt;I basically want to get a substring and grab from the beginning to GMT and set it into a new field Message1 then grab the rest in another substring and put that into message two.&lt;BR /&gt;
Message1= hello 8/30/2017 01:32:00 GMT &lt;BR /&gt;
Message2= goodbye 8/30/2017 01:33:00 GMT &lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 17:33:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313461#M93828</guid>
      <dc:creator>kdimaria</dc:creator>
      <dc:date>2017-08-30T17:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: Can I create a substring from this string with two timestamps?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313462#M93829</link>
      <description>&lt;P&gt;Try something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|  makeresults 
|  eval _raw="Message= hello 8/30/2017 01:32:00 GMT goodbye 8/30/2017 01:33:00 GMT"
|  rex "Message= (?P&amp;lt;Message1&amp;gt;.*?GMT)\s(?P&amp;lt;Message2&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Aug 2017 17:48:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313462#M93829</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2017-08-30T17:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: Can I create a substring from this string with two timestamps?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313463#M93830</link>
      <description>&lt;P&gt;@cpetterborg There are multiple different events though that have different messages like this in a "Notes" field. will the rex command still work if I just did:&lt;/P&gt;

&lt;P&gt;| makeresults | then the rex command you have?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 17:56:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313463#M93830</guid>
      <dc:creator>kdimaria</dc:creator>
      <dc:date>2017-08-30T17:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: Can I create a substring from this string with two timestamps?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313464#M93831</link>
      <description>&lt;P&gt;actually I don't think that'd work&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 18:05:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313464#M93831</guid>
      <dc:creator>kdimaria</dc:creator>
      <dc:date>2017-08-30T18:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: Can I create a substring from this string with two timestamps?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313465#M93832</link>
      <description>&lt;P&gt;@kdimaria, if your current field is &lt;CODE&gt;Notes&lt;/CODE&gt;, you can use just the rex command on that field&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;YourBaseSearch&amp;gt;
| rex field=Notes "Message= (?P&amp;lt;Message1&amp;gt;.*?GMT)\s(?P&amp;lt;Message2&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In case you dont know the field name you can directly apply on _raw data&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;YourBaseSearch&amp;gt;
|  rex field=_raw "Message= (?P&amp;lt;Message1&amp;gt;.*?GMT)\s(?P&amp;lt;Message2&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Aug 2017 18:10:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313465#M93832</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-08-30T18:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Can I create a substring from this string with two timestamps?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313466#M93833</link>
      <description>&lt;P&gt;@cpetterborg Also there is the possibility of there being more than 2 messages with time stamps.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 18:11:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313466#M93833</guid>
      <dc:creator>kdimaria</dc:creator>
      <dc:date>2017-08-30T18:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: Can I create a substring from this string with two timestamps?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313467#M93834</link>
      <description>&lt;P&gt;@cpetterborg I basically just want to split whenever I see "GMT" and put it into a new field&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 18:12:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313467#M93834</guid>
      <dc:creator>kdimaria</dc:creator>
      <dc:date>2017-08-30T18:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: Can I create a substring from this string with two timestamps?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313468#M93835</link>
      <description>&lt;P&gt;@niketnilay Thank you, I think this will work but now I just remembered that theres a possibility of there being more than two messages so I don't know how I would account for that and might have to approach this problem differently.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 18:16:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313468#M93835</guid>
      <dc:creator>kdimaria</dc:creator>
      <dc:date>2017-08-30T18:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: Can I create a substring from this string with two timestamps?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313469#M93836</link>
      <description>&lt;P&gt;If you don't mind a multivalve field:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
|  eval _raw="Message= hello 8/30/2017 01:32:00 GMT goodbye 8/30/2017 01:33:00 GMT foo 8/30/2017 01:32:00 GMT bar 8/30/2017 01:33:00 GMT"
|  rex "Message= (?P&amp;lt;message&amp;gt;.*)" | rex field=message max_match=0 "(?P&amp;lt;Messages&amp;gt;.*?GMT)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Aug 2017 19:53:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313469#M93836</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2017-08-30T19:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: Can I create a substring from this string with two timestamps?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313470#M93837</link>
      <description>&lt;P&gt;@kdimaria, if possible please add some samples.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 20:54:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313470#M93837</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-08-30T20:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: Can I create a substring from this string with two timestamps?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313471#M93838</link>
      <description>&lt;P&gt;Then you can add this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval Message1=mvindex(message, 0)
| eval Message2=mvindex(message, 1)
| eval Message3=mvindex(message, 2)
| eval Message4=mvindex(message, 3)
| eval Message5=mvindex(message, 4)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Aug 2017 22:42:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-create-a-substring-from-this-string-with-two-timestamps/m-p/313471#M93838</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-08-30T22:42:31Z</dc:date>
    </item>
  </channel>
</rss>

