<?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 extract time from a string time field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-time-from-a-string-time-field/m-p/355920#M105296</link>
    <description>&lt;P&gt;This will work -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   | rex field=&amp;lt;existing_field&amp;gt; "(?&amp;lt;DAYS&amp;gt;\d+)\s*Day"
    | rex field=&amp;lt;existing_field&amp;gt; "(?&amp;lt;HOURS&amp;gt;\d+)\s*Hour"
    | rex field=&amp;lt;existing_field&amp;gt; "(?&amp;lt;MINS&amp;gt;\d+)\s*Minute"
    | eval DAYS=if(isnull(DAYS),0,DAYS) | eval HOURS=if(isnull(HOURS),0,HOURS) | eval MINS=if(isnull(MINS),0,MINS) 
    | eval FINAL_TIME=8*DAYS + HOURS + round(MINS/60,2)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 02 May 2017 07:52:32 GMT</pubDate>
    <dc:creator>dineshraj9</dc:creator>
    <dc:date>2017-05-02T07:52:32Z</dc:date>
    <item>
      <title>how to extract time from a string time field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-time-from-a-string-time-field/m-p/355917#M105293</link>
      <description>&lt;P&gt;I have that field that shows time in a string. the values of the field are something like:&lt;BR /&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/2848i6698C5E4DE64B118/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;Is there a way to extract the number of hours for each one?&lt;BR /&gt;
for example if I have value of 2 days I will get 16 hours (8 hours a day), and if I have 30 minutes value, I will get 0.5 hours.&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Sat, 29 Apr 2017 10:15:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-time-from-a-string-time-field/m-p/355917#M105293</guid>
      <dc:creator>matansocher</dc:creator>
      <dc:date>2017-04-29T10:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract time from a string time field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-time-from-a-string-time-field/m-p/355918#M105294</link>
      <description>&lt;P&gt;Create 3 new fields from this existing field and then calculate hours -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=&amp;lt;existing_field&amp;gt; "(?&amp;lt;DAYS&amp;gt;\d+)\s*Day"
| rex field=&amp;lt;existing_field&amp;gt; "(?&amp;lt;HOURS&amp;gt;\d+)\s*Hour"
| rex field=&amp;lt;existing_field&amp;gt; "(?&amp;lt;MINS&amp;gt;\d+)\s*Minute"
| eval FINAL_TIME=8*DAYS + HOURS + round(MINS/60,2)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 29 Apr 2017 11:25:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-time-from-a-string-time-field/m-p/355918#M105294</guid>
      <dc:creator>dineshraj9</dc:creator>
      <dc:date>2017-04-29T11:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract time from a string time field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-time-from-a-string-time-field/m-p/355919#M105295</link>
      <description>&lt;P&gt;I think that might be really helpful for me, but I get no results in the FINAL_TIME field. I think it happens because the values does not contain days hours and minutes, only 1 or 2 of them on each value. I think I need to check if for example "Days" exists in the field and only then try to extract it. what is the best way to do it?&lt;BR /&gt;
Thank you!&lt;/P&gt;</description>
      <pubDate>Sat, 29 Apr 2017 19:29:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-time-from-a-string-time-field/m-p/355919#M105295</guid>
      <dc:creator>matansocher</dc:creator>
      <dc:date>2017-04-29T19:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract time from a string time field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-time-from-a-string-time-field/m-p/355920#M105296</link>
      <description>&lt;P&gt;This will work -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   | rex field=&amp;lt;existing_field&amp;gt; "(?&amp;lt;DAYS&amp;gt;\d+)\s*Day"
    | rex field=&amp;lt;existing_field&amp;gt; "(?&amp;lt;HOURS&amp;gt;\d+)\s*Hour"
    | rex field=&amp;lt;existing_field&amp;gt; "(?&amp;lt;MINS&amp;gt;\d+)\s*Minute"
    | eval DAYS=if(isnull(DAYS),0,DAYS) | eval HOURS=if(isnull(HOURS),0,HOURS) | eval MINS=if(isnull(MINS),0,MINS) 
    | eval FINAL_TIME=8*DAYS + HOURS + round(MINS/60,2)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 May 2017 07:52:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-time-from-a-string-time-field/m-p/355920#M105296</guid>
      <dc:creator>dineshraj9</dc:creator>
      <dc:date>2017-05-02T07:52:32Z</dc:date>
    </item>
  </channel>
</rss>

