<?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: time difference between two events in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/time-difference-between-two-events/m-p/514895#M144540</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/193316"&gt;@surekhasplunk&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;no, if you use also Status in the transaction keys you'll never be able to build the transaction between Critical or Warning and OK because the Status is different.&lt;/P&gt;&lt;P&gt;You need to correlate events with the same Device and Checknames, that starts with Critical or Warning and finish with OK.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Wed, 19 Aug 2020 10:23:54 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2020-08-19T10:23:54Z</dc:date>
    <item>
      <title>time difference between two events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-difference-between-two-events/m-p/514827#M144521</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am using below query to get the details of alarms which has (one Warning and one OK status) or (one Critical and one OK status) per checkname and device. Now how to get the time difference(duration) between the ok and warning messages or ok and critical messages?&lt;/P&gt;&lt;P&gt;index=abc sourcetype=alarms&amp;nbsp; |stats count by Device CheckName Status _time | sort - _time&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="alarm.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/10356iA2909C3EABD12C4F/image-size/large?v=v2&amp;amp;px=999" role="button" title="alarm.PNG" alt="alarm.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;please help&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 03:38:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-difference-between-two-events/m-p/514827#M144521</guid>
      <dc:creator>surekhasplunk</dc:creator>
      <dc:date>2020-08-19T03:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: time difference between two events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-difference-between-two-events/m-p/514836#M144524</link>
      <description>&lt;P&gt;I don't know anything because you've deleted all the important parts.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 04:46:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-difference-between-two-events/m-p/514836#M144524</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-08-19T04:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: time difference between two events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-difference-between-two-events/m-p/514859#M144529</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/193316"&gt;@surekhasplunk&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;as&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/184221"&gt;@to4kawa&lt;/a&gt;&amp;nbsp;said, it's difficoult to help you without informations!&lt;/P&gt;&lt;P&gt;Anyway, analyzing your search, I can image that for each device you have different checknames.&lt;/P&gt;&lt;P&gt;In this case you could modify your search in this way:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=abc sourcetype=alarms  
| stats earliest(_time) AS earliest latest(_time) AS latest values(Status) AS Status dc(Status) AS dc_Status by Device CheckName
| where dc_Status&amp;gt;1
| eval diff=latest-earliest&lt;/LI-CODE&gt;&lt;P&gt;The logic is that:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;you take all the statuses and times for each Device and CheckName,&lt;/LI&gt;&lt;LI&gt;then you take only the ones with two differtent Statuses (if you can have more conditions, you can add other conditions to identify the ones you want to monitor),&lt;/LI&gt;&lt;LI&gt;Then you can calculate the difference between the earliest and the latest.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 07:50:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-difference-between-two-events/m-p/514859#M144529</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-08-19T07:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: time difference between two events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-difference-between-two-events/m-p/514868#M144530</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/184221"&gt;@to4kawa&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="alarm.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/10360i2CE29AAB53DE4DF0/image-size/large?v=v2&amp;amp;px=999" role="button" title="alarm.PNG" alt="alarm.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for not uploading valued info.&lt;/P&gt;&lt;P&gt;I am uploading again... here the First Column Device i am giving details of 1 single device but here multiple devices can come when i dont filter for that device name.&amp;nbsp;&lt;/P&gt;&lt;P&gt;And for each checkname there can be one or more ok and warning&amp;nbsp; or&amp;nbsp; ok and critical messages&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 08:31:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-difference-between-two-events/m-p/514868#M144530</guid>
      <dc:creator>surekhasplunk</dc:creator>
      <dc:date>2020-08-19T08:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: time difference between two events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-difference-between-two-events/m-p/514878#M144531</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/193316"&gt;@surekhasplunk&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;is there ani other information that can be used to identify each transaction?&lt;/P&gt;&lt;P&gt;if yes, use it in the BY clause and you'll have the results.&lt;/P&gt;&lt;P&gt;If not, you have to use the transaction command (very slow!), something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=abc sourcetype=alarms  
| transaction Device CheckName startwith="Critical OR Warning" endswith"OK"
| where duration&amp;gt;0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 09:04:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-difference-between-two-events/m-p/514878#M144531</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-08-19T09:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: time difference between two events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-difference-between-two-events/m-p/514882#M144533</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do i have to concatenate the CheckName and Status fields together for the query to work ?&lt;/P&gt;&lt;P&gt;As i modified your query to add the Status field as that holds the value Critical/Warning/OK&lt;/P&gt;&lt;P&gt;whereas CheckName field is common between the events. And i receive 0 results am not sure why&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=abc sourcetype=alarms  
| transaction Device CheckName Status startswith="Critical OR Warning" endswith="OK"
| where duration&amp;gt;0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 09:32:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-difference-between-two-events/m-p/514882#M144533</guid>
      <dc:creator>surekhasplunk</dc:creator>
      <dc:date>2020-08-19T09:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: time difference between two events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-difference-between-two-events/m-p/514887#M144536</link>
      <description>&lt;P&gt;&lt;SPAN&gt;index=abc sourcetype=alarms&amp;nbsp; |stats range(_time) as duration min(_time) as _time by Device CheckName&amp;nbsp; | sort - _time&lt;BR /&gt;&lt;BR /&gt;How about this?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 09:47:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-difference-between-two-events/m-p/514887#M144536</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-08-19T09:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: time difference between two events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-difference-between-two-events/m-p/514889#M144537</link>
      <description>&lt;P&gt;Maybe the delta command is what you're looking for?&lt;/P&gt;&lt;P&gt;for example:&lt;/P&gt;&lt;P&gt;index=_internal&lt;BR /&gt;| delta_time as timedifference&lt;BR /&gt;| table timedifference _time&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 09:56:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-difference-between-two-events/m-p/514889#M144537</guid>
      <dc:creator>rrovers</dc:creator>
      <dc:date>2020-08-19T09:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: time difference between two events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-difference-between-two-events/m-p/514895#M144540</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/193316"&gt;@surekhasplunk&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;no, if you use also Status in the transaction keys you'll never be able to build the transaction between Critical or Warning and OK because the Status is different.&lt;/P&gt;&lt;P&gt;You need to correlate events with the same Device and Checknames, that starts with Critical or Warning and finish with OK.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 10:23:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-difference-between-two-events/m-p/514895#M144540</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-08-19T10:23:54Z</dc:date>
    </item>
  </channel>
</rss>

