<?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 How to subtract miliseconds from _time ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-miliseconds-from-time/m-p/463915#M140495</link>
    <description>&lt;P&gt;I have a field  serv_time = 44432  in miliseconds.&lt;BR /&gt;
and the default field _time.&lt;BR /&gt;
 I want to be able to subtract   _time - serv_time  (_time minus - serv-time) &lt;/P&gt;

&lt;P&gt;and get the result in a human readable format ?&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 04:49:30 GMT</pubDate>
    <dc:creator>zacksoft</dc:creator>
    <dc:date>2020-09-30T04:49:30Z</dc:date>
    <item>
      <title>How to subtract miliseconds from _time ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-miliseconds-from-time/m-p/463915#M140495</link>
      <description>&lt;P&gt;I have a field  serv_time = 44432  in miliseconds.&lt;BR /&gt;
and the default field _time.&lt;BR /&gt;
 I want to be able to subtract   _time - serv_time  (_time minus - serv-time) &lt;/P&gt;

&lt;P&gt;and get the result in a human readable format ?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:49:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-miliseconds-from-time/m-p/463915#M140495</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2020-09-30T04:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract miliseconds from _time ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-miliseconds-from-time/m-p/463916#M140496</link>
      <description>&lt;P&gt;_time is an epoch time that holds seconds since some base date.   Here's some code that manipulates those values in the way you're asking for:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval serv_time = 44432
| eval epoch_time = _time 
| eval human_epoch_time = strftime(epoch_time,"%y-%m-%d %H:%M:%S.%N")
| eval sub_time = epoch_time - (serv_time/1000) 
| eval human_time = strftime(sub_time,"%y-%m-%d %H:%M:%S.%N")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Apr 2020 13:36:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-miliseconds-from-time/m-p/463916#M140496</guid>
      <dc:creator>memarshall63</dc:creator>
      <dc:date>2020-04-03T13:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract miliseconds from _time ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-miliseconds-from-time/m-p/463917#M140497</link>
      <description>&lt;P&gt;I'm not getting the expected result. I am not getting the subtracted time.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index="bayseian" source="/apps/runner/mahem/logs/sachin.out" | rex field=_raw "(?ms)^(?P&amp;lt;boot_end&amp;gt;\\d+\\-\\w+\\-\\d+\\s+\\d+:\\d+)(?:[^ \\n]* ){7}(?P&amp;lt;boot_time&amp;gt;\\d+)" offset_field=_extracted_fields_bounds

     | eval serv_time = boot_time
 | eval epoch_time = _time 
 | eval human_epoch_time = strftime(epoch_time,"%y-%m-%d %H:%M:%S.%N")
 | eval sub_time = epoch_time - (boot_time/1000) 
 | eval human_time = strftime(sub_time,"%y-%m-%d %H:%M:%S.%N")
 | eval sub_time = strftime(sub_time,"%y-%m-%d %H:%M:%S.%N")

 | table human_time sub_time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Apr 2020 15:29:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-miliseconds-from-time/m-p/463917#M140497</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2020-04-03T15:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract miliseconds from _time ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-miliseconds-from-time/m-p/463918#M140498</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/65483"&gt;@zacksoft&lt;/a&gt; in your uuery human_time and sub_time are both formatting sub_time -- so they'll be the same.&lt;/P&gt;

&lt;P&gt;If you change your last line to display:&lt;/P&gt;

&lt;P&gt;|table human_epoch_time sub_time human_time&lt;/P&gt;

&lt;P&gt;You should see the diff between human_epoch_time and sub_time&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:52:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-miliseconds-from-time/m-p/463918#M140498</guid>
      <dc:creator>memarshall63</dc:creator>
      <dc:date>2020-09-30T04:52:06Z</dc:date>
    </item>
  </channel>
</rss>

