<?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: Splitting a Field into multiple values - separating date from time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-Field-into-multiple-values-separating-date-from-time/m-p/173684#M49813</link>
    <description>&lt;P&gt;If this is the timestamp of the event then on index time this should be correctly extracted&lt;BR /&gt;
Everything else can be done later during search time&lt;BR /&gt;
In the case this is the Event time then simply use the _time field and extract of it what you want using the eval function with strftime&lt;BR /&gt;
&lt;A href="http://www.wowhead.com/news=242815/preparing-for-6-0-guide-to-removed-mounts-pets-transmog-gear-titles-achievements" target="_blank"&gt;http://www.wowhead.com/news=242815/preparing-for-6-0-guide-to-removed-mounts-pets-transmog-gear-titles-achievements&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;If it is not the event time, extract the strings during search time and process them accordingly using eval and strptime&lt;/P&gt;

&lt;P&gt;To extract it use a regex like (?&amp;lt;submit_date&amp;gt;BLd{1,2}BL/BLd{1,2}BL/BLd{4})BLs+(?&amp;lt;submit_time&amp;gt;BLd{2}:BLd{2}:BLd{2}BLs+BLw{2})&lt;BR /&gt;
not tested but should be close enough to figure out&lt;/P&gt;

&lt;P&gt;PS i had the removal of &amp;lt; and &amp;gt; and backslash ... &lt;BR /&gt;
BL stands for backslash since it wont be printed here ...&lt;/P&gt;

&lt;P&gt;Good luck &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 18:00:01 GMT</pubDate>
    <dc:creator>mathiask</dc:creator>
    <dc:date>2020-09-28T18:00:01Z</dc:date>
    <item>
      <title>Splitting a Field into multiple values - separating date from time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-Field-into-multiple-values-separating-date-from-time/m-p/173683#M49812</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I have a field called Submit Date and it's format is like this: 10/21/2014 11:26:05 AM&lt;/P&gt;

&lt;P&gt;I'm trying to separate this into 2 fields, to something like &lt;/P&gt;

&lt;P&gt;Submit Date: 10/21/2014&lt;BR /&gt;
Submit Time: 11:26:05 AM&lt;/P&gt;

&lt;P&gt;I'm hoping to work out the average difference between the start and end of each event, so if I could also find a way to detect whether or not it's AM or PM and then convert to 24 hour clock, that would also be helpful.&lt;/P&gt;

&lt;P&gt;If anyone has any suggestions as a way to deal with averaging the differences / response time, please let me know.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Oct 2014 08:44:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-Field-into-multiple-values-separating-date-from-time/m-p/173683#M49812</guid>
      <dc:creator>markthompson</dc:creator>
      <dc:date>2014-10-22T08:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Field into multiple values - separating date from time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-Field-into-multiple-values-separating-date-from-time/m-p/173684#M49813</link>
      <description>&lt;P&gt;If this is the timestamp of the event then on index time this should be correctly extracted&lt;BR /&gt;
Everything else can be done later during search time&lt;BR /&gt;
In the case this is the Event time then simply use the _time field and extract of it what you want using the eval function with strftime&lt;BR /&gt;
&lt;A href="http://www.wowhead.com/news=242815/preparing-for-6-0-guide-to-removed-mounts-pets-transmog-gear-titles-achievements" target="_blank"&gt;http://www.wowhead.com/news=242815/preparing-for-6-0-guide-to-removed-mounts-pets-transmog-gear-titles-achievements&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;If it is not the event time, extract the strings during search time and process them accordingly using eval and strptime&lt;/P&gt;

&lt;P&gt;To extract it use a regex like (?&amp;lt;submit_date&amp;gt;BLd{1,2}BL/BLd{1,2}BL/BLd{4})BLs+(?&amp;lt;submit_time&amp;gt;BLd{2}:BLd{2}:BLd{2}BLs+BLw{2})&lt;BR /&gt;
not tested but should be close enough to figure out&lt;/P&gt;

&lt;P&gt;PS i had the removal of &amp;lt; and &amp;gt; and backslash ... &lt;BR /&gt;
BL stands for backslash since it wont be printed here ...&lt;/P&gt;

&lt;P&gt;Good luck &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:00:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-Field-into-multiple-values-separating-date-from-time/m-p/173684#M49813</guid>
      <dc:creator>mathiask</dc:creator>
      <dc:date>2020-09-28T18:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Field into multiple values - separating date from time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-Field-into-multiple-values-separating-date-from-time/m-p/173685#M49814</link>
      <description>&lt;P&gt;This is an actual field in the data as submitted date &amp;amp; also Closed Date&lt;/P&gt;

&lt;P&gt;And I've never used regex command before, so Don't have a clue how to use it.  &lt;/P&gt;</description>
      <pubDate>Wed, 22 Oct 2014 09:08:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-Field-into-multiple-values-separating-date-from-time/m-p/173685#M49814</guid>
      <dc:creator>markthompson</dc:creator>
      <dc:date>2014-10-22T09:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Field into multiple values - separating date from time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-Field-into-multiple-values-separating-date-from-time/m-p/173686#M49815</link>
      <description>&lt;P&gt;You probably have to learn it ...&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.4/SearchReference/rex" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/6.1.4/SearchReference/rex&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.4/Knowledge/AboutSplunkregularexpressions" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/6.1.4/Knowledge/AboutSplunkregularexpressions&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;To give you a short introduction about the string I wrote&lt;BR /&gt;
 - it will try to find the pattern defined in the expression&lt;BR /&gt;
 - the part within the round brackets defines one return value and the field/key it will be associated with is defined in the arrow brackets following the question mark.&lt;/P&gt;

&lt;P&gt;so the first part will look for a pattern that starts with one or two digits (defined by the backslash d{1,2}, followed by a slash (defined by backslash slash) followed by again one or two digits and a slash followed by for digits. The result will be returned as a value and given to the key submit_date. The backslash s plus stands for one or more Whitespaces, this is not withing round brackets since we don't need the space&lt;BR /&gt;
so it looks for something like&lt;BR /&gt;
d(d)/d(d)/dddd which will match the 10/21/2014 so you get submit_date=10/21/2014&lt;BR /&gt;
This pattern also allows that 9/9/2014 will be extracted.&lt;BR /&gt;
The pattern is very specific and will not match a/bb/2014 since a and b are not numbers. I did this because there is not much context before or after the time string like "submit time 20/10/2014 12:05:15 AM"&lt;/P&gt;

&lt;P&gt;Keep in mind this is now only a string. To do some math, difference etc you first have to convert it into a time value with strptime and then convert the result back using strftime&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:00:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-Field-into-multiple-values-separating-date-from-time/m-p/173686#M49815</guid>
      <dc:creator>mathiask</dc:creator>
      <dc:date>2020-09-28T18:00:04Z</dc:date>
    </item>
  </channel>
</rss>

