<?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 Duration between two events with conditions in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Duration-between-two-events-with-conditions/m-p/558364#M158602</link>
    <description>&lt;P&gt;Hi guys&lt;/P&gt;&lt;P&gt;Im pretty new to Splunk and do not know how to create the search I need.&lt;/P&gt;&lt;P&gt;We are forwarding events from our Faul Monitoring toward Splunk. there are three Type of event having the same fields. The three types are SET, UPDATE and CLEAR. So if an alarm is raised SET is the first event in Splunk afterward if more fields are filled in the monitoring UPDATE events are coming to splunk. Depending on the fault several (n) update events can be there. If the fault is closed the CLEAR event is received by Splunk.&lt;/P&gt;&lt;P&gt;At some point the field "TTID" in an update event contains a TTID but all following UPDATES will contain it as well. What I try to achiev is searching for SET AND UPDATE and calculate the duration between the SET and the first UPDATE which is containing *INC* in the TTID field&lt;/P&gt;&lt;P&gt;I've created a search to get duration between SET and CLEAR but as UPDATE can be there n-times I do not know how to really get the time between the first UPDATE containing *INC* in the TTID field&lt;/P&gt;&lt;P&gt;Thanks a lot for your help&lt;/P&gt;</description>
    <pubDate>Tue, 06 Jul 2021 07:40:47 GMT</pubDate>
    <dc:creator>pgraf</dc:creator>
    <dc:date>2021-07-06T07:40:47Z</dc:date>
    <item>
      <title>Duration between two events with conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Duration-between-two-events-with-conditions/m-p/558364#M158602</link>
      <description>&lt;P&gt;Hi guys&lt;/P&gt;&lt;P&gt;Im pretty new to Splunk and do not know how to create the search I need.&lt;/P&gt;&lt;P&gt;We are forwarding events from our Faul Monitoring toward Splunk. there are three Type of event having the same fields. The three types are SET, UPDATE and CLEAR. So if an alarm is raised SET is the first event in Splunk afterward if more fields are filled in the monitoring UPDATE events are coming to splunk. Depending on the fault several (n) update events can be there. If the fault is closed the CLEAR event is received by Splunk.&lt;/P&gt;&lt;P&gt;At some point the field "TTID" in an update event contains a TTID but all following UPDATES will contain it as well. What I try to achiev is searching for SET AND UPDATE and calculate the duration between the SET and the first UPDATE which is containing *INC* in the TTID field&lt;/P&gt;&lt;P&gt;I've created a search to get duration between SET and CLEAR but as UPDATE can be there n-times I do not know how to really get the time between the first UPDATE containing *INC* in the TTID field&lt;/P&gt;&lt;P&gt;Thanks a lot for your help&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 07:40:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Duration-between-two-events-with-conditions/m-p/558364#M158602</guid>
      <dc:creator>pgraf</dc:creator>
      <dc:date>2021-07-06T07:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: Duration between two events with conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Duration-between-two-events-with-conditions/m-p/558366#M158604</link>
      <description>&lt;P&gt;Can you provide some (anonymised) sample events so we can see what you are dealing with. Also, what does your current search look like? Please provide in code blocks &amp;lt;/&amp;gt; so it is easier for those of us with poor eyesight to read, and to use as test data for our proposed solutions.&lt;/P&gt;&lt;P&gt;By the way, how do you know which CLEAR relates to which SET if the TTID isn't provided until an UPDATE?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 08:09:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Duration-between-two-events-with-conditions/m-p/558366#M158604</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-07-06T08:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: Duration between two events with conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Duration-between-two-events-with-conditions/m-p/558369#M158606</link>
      <description>&lt;P&gt;I've anonymised an SET and UPDATE event which you can see below. To find the related events I'm using the field "AlarmID".&lt;/P&gt;&lt;P&gt;Unfortunately, I'm not really having an idea how to properly do it, so I don't have any search for that particular request but I'll past the search I'm using to get duration till clear.&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;P&gt;Event Example&lt;/P&gt;&lt;P&gt;This is the UPDATE Event&lt;BR /&gt;============================================================&lt;BR /&gt;Current Date and Time is : Mon Jul 5 17:47:31 CEST 2021&lt;BR /&gt;Alarm Notification from XXXXXXXXXX&lt;BR /&gt;&lt;BR /&gt;Alarm UPDATEd:&lt;BR /&gt;UpdateDate: 07/05/2021&lt;BR /&gt;UpdateTime: 17:47:31&lt;BR /&gt;DeviceType: XXXXXXXXXXX&lt;BR /&gt;Mtype: XXXXXXXX&lt;BR /&gt;ModelName: XXXXXXXXXX&lt;BR /&gt;AlarmID: 6755882&lt;BR /&gt;AlarmTitle: Issue with Network Device&lt;BR /&gt;TTID: INCXXXXXXXX&lt;BR /&gt;GlobalAlarmID: 12345678-12345678-12344566&lt;BR /&gt;Severity: CRITICAL&lt;BR /&gt;ProbableCauseID: 10009&lt;BR /&gt;RepairPerson:&lt;BR /&gt;AlarmStatus: XXXXXXXXX&lt;BR /&gt;IPAddress: xx.xx.xx.xx&lt;BR /&gt;AlarmState: NEW&lt;BR /&gt;Acknowledged: FALSE&lt;BR /&gt;UserClearable: FALSE&lt;BR /&gt;Location:&lt;BR /&gt;AlarmAge: 0&lt;BR /&gt;NotificationData:&lt;BR /&gt;ProbableCause: Issue with Network Device&lt;BR /&gt;IfName: XXXXXXXXX&lt;BR /&gt;IfDesc: XXXXXXXXX&lt;BR /&gt;IfAlias: XXXXXXXXXX&lt;BR /&gt;TicketStatus: XXXXXXXXXX&lt;BR /&gt;CRQ_ID:&lt;BR /&gt;Maintenance:&lt;BR /&gt;EnrichmentInfo: Processing_time_00:06:04&lt;BR /&gt;============================================================&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the SET event&lt;BR /&gt;============================================================&lt;BR /&gt;Current Date and Time is : Mon Jul 5 17:38:28 CEST 2021&lt;BR /&gt;Alarm Notification from XXXXXXXX&lt;BR /&gt;&lt;BR /&gt;Alarm SET:&lt;BR /&gt;SetDate: 07/05/2021&lt;BR /&gt;SetTime: 17:38:27&lt;BR /&gt;DeviceType: XXXXXXXXXXX&lt;BR /&gt;Mtype: XXXXXXXXXXX&lt;BR /&gt;ModelName: XXXXXXXXXXX&lt;BR /&gt;AlarmID: 6755882&lt;BR /&gt;AlarmTitle: Issue with Network Device&lt;BR /&gt;TTID:&lt;BR /&gt;GlobalAlarmID: 12345678-12345678-12344566&lt;BR /&gt;Severity: CRITICAL&lt;BR /&gt;ProbableCauseID: 10009&lt;BR /&gt;RepairPerson:&lt;BR /&gt;AlarmStatus:&lt;BR /&gt;IPAddress: XXXXXXXXXXX&lt;BR /&gt;AlarmState: NEW&lt;BR /&gt;Acknowledged: FALSE&lt;BR /&gt;UserClearable: FALSE&lt;BR /&gt;Location:&lt;BR /&gt;AlarmAge: 0&lt;BR /&gt;NotificationData:&lt;BR /&gt;ProbableCause: Issue with Network Device&lt;BR /&gt;IfName: XXXXXXXXXXX&lt;BR /&gt;IfDesc: XXXXXXXXXXX&lt;BR /&gt;IfAlias: XXXXXXXXXXX&lt;BR /&gt;TicketStatus:&lt;BR /&gt;CRQ_ID:&lt;BR /&gt;Maintenance:&lt;BR /&gt;EnrichmentInfo:&lt;BR /&gt;============================================================&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Search I'm using for the Clear Case (thats already a drilldown search from a bar chart in which a counting of alarms cleared in a bucket is presented)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=general sourcetype=alarming (Event_Type=SET OR Event_Type=CLEARER) 
| transaction AlarmID startswith=Event_Type=SET endswith=Event_Type=CLEARED
| eval duration_bucket=case(duration&amp;lt;=10, "0-10sec", duration=0, "0sec", duration&amp;gt;10 AND duration&amp;lt;=30, "10-30sec", duration&amp;gt;30 AND duration&amp;lt;=60, "30-60sec", duration&amp;gt;60 AND duration&amp;lt;=120, "60-120sec", duration&amp;gt;120 AND duration&amp;lt;=180, "120-180sec", duration&amp;gt;180 AND duration&amp;lt;=240, "180-240sec", duration&amp;gt;240 AND duration&amp;lt;=300, "240-300sec", duration&amp;gt;300, "&amp;gt;300sec")
| search duration_bucket=180-240sec
| table _time, DeviceName, AlarmTitle, duration&lt;/LI-CODE&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Tue, 06 Jul 2021 08:40:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Duration-between-two-events-with-conditions/m-p/558369#M158606</guid>
      <dc:creator>pgraf</dc:creator>
      <dc:date>2021-07-06T08:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: Duration between two events with conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Duration-between-two-events-with-conditions/m-p/558405#M158617</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=general sourcetype=alarming (Event_Type=SET OR Event_Type=CLEAR OR Event_Type=UPDATE) 
| fields _time AlarmID TTID Event_Type
| eval inctime=if(match(TTID,"INC"),_time,null())
| eval cleartime=if(Event_Type="CLEAR",_time,null())
| eval TTID=if(TTID="",null(),TTID)
| eval setevent=if(Event_Type="SET",1,null())
| sort 0 _time
| streamstats sum(setevent) as setevent by AlarmID
| stats first(inctime) as inctime first(_time) as settime first(TTID) as TTID first(cleartime) as cleartime by AlarmID setevent&lt;/LI-CODE&gt;&lt;P&gt;This assumes that there is only one set and one clear per alarm at any one time.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 13:22:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Duration-between-two-events-with-conditions/m-p/558405#M158617</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-07-06T13:22:44Z</dc:date>
    </item>
  </channel>
</rss>

