<?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 find the average time difference between eventTime and recordTime in IDS? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-average-time-difference-between-eventTime-and/m-p/263639#M79128</link>
    <description>&lt;P&gt;Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=IDS_Event | convert timeformat="%b %d %H:%M:%S" mktime(*Time) | eval Diff=(recordTime - eventTime)/60 | eval Diff=IF(Diff&amp;lt;0,0,Diff) | search Diff&amp;gt;10 | eval _time=eventTime  | timechart span=1h avg(Diff) by sensor
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 02 Feb 2016 19:38:42 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-02-02T19:38:42Z</dc:date>
    <item>
      <title>How to find the average time difference between eventTime and recordTime in IDS?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-average-time-difference-between-eventTime-and/m-p/263637#M79126</link>
      <description>&lt;P&gt;In IDS, I have an &lt;STRONG&gt;eventTime&lt;/STRONG&gt; and a &lt;STRONG&gt;recordTime&lt;/STRONG&gt;. The recordTime is the timestamp that Splunk uses to record the events. I know how to get the diff between the eventTime and the recordTime.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=IDS_Event | convert timeformat="%b %d %H:%M:%S" mktime(*Time) | eval diff_sec=(recordTime - eventTime) | eval diff_min=(diff_sec/60) | eval Diff=IF(diff_min&amp;lt;0,0,diff_min) | search Diff&amp;gt;10
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I need now is to find the avg(Diff) per hour for each of the sensors so I can see when I an having a latency issue and for which sensor.&lt;/P&gt;

&lt;P&gt;I tried this search but didn't get what I needed.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=IDS_Event | convert timeformat="%b %d %H:%M:%S" mktime(*Time) | eval diff_sec=(recordTime - eventTime) | eval diff_min=(diff_sec/60) | eval Diff=IF(diff_min&amp;lt;0,0,diff_min) | search Diff&amp;gt;10 | bucket eventTime span=1h | chart avg(Diff) by sensor
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=IDS_Event | convert timeformat="%b %d %H:%M:%S" mktime(*Time) | eval diff_sec=(recordTime - eventTime) | eval diff_min=(diff_sec/60) | eval Diff=IF(diff_min&amp;lt;0,0,diff_min) | search Diff&amp;gt;10  | timechart span=1h avg(Diff) by sensor
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also the true time of the event is the eventTime so I would like to show the timechart with reference to the eventTime, not the recordTime.&lt;/P&gt;

&lt;P&gt;Any suggestions would be greatly appreciated&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2016 19:29:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-average-time-difference-between-eventTime-and/m-p/263637#M79126</guid>
      <dc:creator>hartfoml</dc:creator>
      <dc:date>2016-02-02T19:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the average time difference between eventTime and recordTime in IDS?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-average-time-difference-between-eventTime-and/m-p/263638#M79127</link>
      <description>&lt;P&gt;I think I figured this one out myself&lt;/P&gt;

&lt;P&gt;I needed to convert _time to eventTime and then the chart worked and looked better&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;eventtype=IDS_Event | convert timeformat="%b %d %H:%M:%S" mktime(*Time) | eval _time=eventTime | eval diff_sec=(recordTime - eventTime) | eval diff_min=(diff_sec/60) | eval Diff=IF(diff_min&amp;lt;0,0,diff_min) | search Diff&amp;gt;10  | timechart span=1h avg(Diff) by sensor&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Any other suggestions would be great&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2016 19:38:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-average-time-difference-between-eventTime-and/m-p/263638#M79127</guid>
      <dc:creator>hartfoml</dc:creator>
      <dc:date>2016-02-02T19:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the average time difference between eventTime and recordTime in IDS?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-average-time-difference-between-eventTime-and/m-p/263639#M79128</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=IDS_Event | convert timeformat="%b %d %H:%M:%S" mktime(*Time) | eval Diff=(recordTime - eventTime)/60 | eval Diff=IF(Diff&amp;lt;0,0,Diff) | search Diff&amp;gt;10 | eval _time=eventTime  | timechart span=1h avg(Diff) by sensor
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Feb 2016 19:38:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-average-time-difference-between-eventTime-and/m-p/263639#M79128</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-02-02T19:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the average time difference between eventTime and recordTime in IDS?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-average-time-difference-between-eventTime-and/m-p/263640#M79129</link>
      <description>&lt;P&gt;thanks I had the same though just after I posted the question&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2016 19:44:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-average-time-difference-between-eventTime-and/m-p/263640#M79129</guid>
      <dc:creator>hartfoml</dc:creator>
      <dc:date>2016-02-02T19:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the average time difference between eventTime and recordTime in IDS?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-average-time-difference-between-eventTime-and/m-p/263641#M79130</link>
      <description>&lt;P&gt;Yeah...The one you've is probably the best method for calculating that. Just few eval that you can remove to improve search performance a little.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=IDS_Event | convert timeformat="%b %d %H:%M:%S" mktime(*Time) | eval Diff=(recordTime - eventTime)/60 | search Diff&amp;gt;10 | eval _time=eventTime  | timechart span=1h avg(Diff) by sensor
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Feb 2016 19:52:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-average-time-difference-between-eventTime-and/m-p/263641#M79130</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-02-02T19:52:47Z</dc:date>
    </item>
  </channel>
</rss>

