<?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 get index time in subseconds ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-index-time-in-subseconds/m-p/189508#M54595</link>
    <description>&lt;P&gt;Running your query for my &lt;CODE&gt;_internal&lt;/CODE&gt; index does give me subseconds.&lt;/P&gt;

&lt;P&gt;There's a much greater problem though. Your convert call treats the time difference in &lt;CODE&gt;index_lag&lt;/CODE&gt; as a unix time epoch timestamp. As a result, a value of 86400 is treated exactly the same as a value of 0 because you're cutting off the day that would roll over. Similarly, negative values would be ignored.&lt;BR /&gt;
It'd be better to use the &lt;CODE&gt;duration&lt;/CODE&gt; conversion Splunk offers:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main | eval index_lag = _indextime - _time | eval converted_index_lag = tostring(index_lag, "duration")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That will still provide a wonky handling of negative values, but at least you won't see lags over a day being wrapped to within one day.&lt;/P&gt;

&lt;P&gt;Both options should show milliseconds though.&lt;/P&gt;</description>
    <pubDate>Wed, 25 Dec 2013 22:34:41 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2013-12-25T22:34:41Z</dc:date>
    <item>
      <title>How to get index time in subseconds ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-index-time-in-subseconds/m-p/189507#M54594</link>
      <description>&lt;P&gt;Hi Splunkers,&lt;/P&gt;

&lt;P&gt;I want to know the index time lag in subsecond order by following command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main | eval index_lag = _indextime - _time | convert  timeformat="%H:%M:%S.%3N" ctime(index_lag)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But the values of "index_lag" are below.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;00:00:00.000
00:00:01.000
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;These results may be wrong in subseconds.&lt;BR /&gt;
How to get correct figures ?&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Dec 2013 06:58:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-index-time-in-subseconds/m-p/189507#M54594</guid>
      <dc:creator>sunrise</dc:creator>
      <dc:date>2013-12-25T06:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to get index time in subseconds ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-index-time-in-subseconds/m-p/189508#M54595</link>
      <description>&lt;P&gt;Running your query for my &lt;CODE&gt;_internal&lt;/CODE&gt; index does give me subseconds.&lt;/P&gt;

&lt;P&gt;There's a much greater problem though. Your convert call treats the time difference in &lt;CODE&gt;index_lag&lt;/CODE&gt; as a unix time epoch timestamp. As a result, a value of 86400 is treated exactly the same as a value of 0 because you're cutting off the day that would roll over. Similarly, negative values would be ignored.&lt;BR /&gt;
It'd be better to use the &lt;CODE&gt;duration&lt;/CODE&gt; conversion Splunk offers:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main | eval index_lag = _indextime - _time | eval converted_index_lag = tostring(index_lag, "duration")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That will still provide a wonky handling of negative values, but at least you won't see lags over a day being wrapped to within one day.&lt;/P&gt;

&lt;P&gt;Both options should show milliseconds though.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Dec 2013 22:34:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-index-time-in-subseconds/m-p/189508#M54595</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-12-25T22:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to get index time in subseconds ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-index-time-in-subseconds/m-p/189509#M54596</link>
      <description>&lt;P&gt;Thank you, martin_mueller.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Dec 2013 03:20:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-index-time-in-subseconds/m-p/189509#M54596</guid>
      <dc:creator>sunrise</dc:creator>
      <dc:date>2013-12-26T03:20:29Z</dc:date>
    </item>
  </channel>
</rss>

