<?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 can I account for delay in response in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-can-I-account-for-delay-in-response/m-p/672411#M15653</link>
    <description>&lt;P&gt;Will MSGID1 always appear in the first search if it is found in the second search?&lt;/P&gt;&lt;P&gt;If so, then the first search should be at least 1 hour longer than the second search, and if MSGID1 is not found in the first search but is in the second search, then it has taken longer than an hour.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Dec 2023 14:51:54 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2023-12-20T14:51:54Z</dc:date>
    <item>
      <title>How can I account for delay in response</title>
      <link>https://community.splunk.com/t5/Alerting/How-can-I-account-for-delay-in-response/m-p/672408#M15651</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have 2 searches that return message ids given certain field values.&lt;/P&gt;&lt;P&gt;The first search&lt;/P&gt;&lt;PRE&gt;index=messages* MSG_src="AAAAA" MSG_DOMAIN="BBBBBB" MSG_TYPE="CC *"
| rename MSGID AS MSGID1&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;The second search&lt;/P&gt;&lt;PRE&gt;index=messages* MSG_src="CCCCCC", MSG_DOMAIN="DDDDDDD", MSG_TYPE="Workflow Start"
| rex field=_raw "&amp;lt;pmt&amp;gt;(?&amp;lt;pmt&amp;gt;.*)&amp;lt;/pmt&amp;gt;"
| rex field=_raw &amp;lt;EventId&amp;gt;(?&amp;lt;MSGID1&amp;gt;.*)&amp;lt;/EventId&amp;gt;
| search pmt=EEEEEEE&lt;/PRE&gt;&lt;P&gt;The results from the second search could come in up to an hour after the results from the first search. It is not an issue unless it takes over an hour.&lt;/P&gt;&lt;P&gt;How can I account for this time delay so I can accurately alert if the span is longer than an hour?&lt;/P&gt;&lt;P&gt;Thanks for the help!&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 14:25:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-can-I-account-for-delay-in-response/m-p/672408#M15651</guid>
      <dc:creator>tkwaller1</dc:creator>
      <dc:date>2023-12-20T14:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: How can I account for delay in response</title>
      <link>https://community.splunk.com/t5/Alerting/How-can-I-account-for-delay-in-response/m-p/672410#M15652</link>
      <description>&lt;P&gt;What links the results of the first search to the results of the second search?&amp;nbsp; Without that, there is no solution to the problem.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 14:48:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-can-I-account-for-delay-in-response/m-p/672410#M15652</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-12-20T14:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: How can I account for delay in response</title>
      <link>https://community.splunk.com/t5/Alerting/How-can-I-account-for-delay-in-response/m-p/672411#M15653</link>
      <description>&lt;P&gt;Will MSGID1 always appear in the first search if it is found in the second search?&lt;/P&gt;&lt;P&gt;If so, then the first search should be at least 1 hour longer than the second search, and if MSGID1 is not found in the first search but is in the second search, then it has taken longer than an hour.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 14:51:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-can-I-account-for-delay-in-response/m-p/672411#M15653</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-12-20T14:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: How can I account for delay in response</title>
      <link>https://community.splunk.com/t5/Alerting/How-can-I-account-for-delay-in-response/m-p/672417#M15654</link>
      <description>&lt;P&gt;I was thinking something like this would work but its probably not the best way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=messages* earliest=-2h MSG_src="AAAAA" MSG_DOMAIN="BBBBBB" MSG_TYPE="CC *"
| rename MSGID AS MSGID1
| append [search index=messages* MSG_src="CCCCCC", MSG_DOMAIN="DDDDDDD", MSG_TYPE="Workflow Start"
| rex field=_raw "&amp;lt;pmt&amp;gt;(?&amp;lt;pmt&amp;gt;.*)&amp;lt;/pmt&amp;gt;"
| rex field=_raw &amp;lt;EventId&amp;gt;(?&amp;lt;MSGID1&amp;gt;.*)&amp;lt;/EventId&amp;gt;
| search pmt=EEEEEEE]
| stats count by MSGID1
| search count&amp;lt;2&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem I see in testing is that this triggers on new IDs that have come in but are still within the hour timeframe.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 16:00:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-can-I-account-for-delay-in-response/m-p/672417#M15654</guid>
      <dc:creator>tkwaller1</dc:creator>
      <dc:date>2023-12-20T16:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: How can I account for delay in response</title>
      <link>https://community.splunk.com/t5/Alerting/How-can-I-account-for-delay-in-response/m-p/672422#M15655</link>
      <description>&lt;P&gt;The records are linked via ID in the first search its MSGID in the second search its extracted from&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| rex field=_raw "&amp;lt;EventId&amp;gt;(?&amp;lt;MSGID1&amp;gt;.*)&amp;lt;/EventId&amp;gt;"&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 20 Dec 2023 16:06:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-can-I-account-for-delay-in-response/m-p/672422#M15655</guid>
      <dc:creator>tkwaller1</dc:creator>
      <dc:date>2023-12-20T16:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: How can I account for delay in response</title>
      <link>https://community.splunk.com/t5/Alerting/How-can-I-account-for-delay-in-response/m-p/672429#M15656</link>
      <description>&lt;P&gt;Maybe something like this?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| multisearch
    [
        | search index=messages* MSG_src="AAAAA" MSG_DOMAIN="BBBBBB" MSG_TYPE="CC *"
            | rename
                MSGID as MSGID1
        ]
    [
        | search index=messages* MSG_src="CCCCCC", MSG_DOMAIN="DDDDDDD", MSG_TYPE="Workflow Start"
            | rex field=_raw "&amp;lt;pmt&amp;gt;(?&amp;lt;pmt&amp;gt;.*)&amp;lt;\/pmt&amp;gt;"
            | rex field=_raw "&amp;lt;EventId&amp;gt;(?&amp;lt;MSGID1&amp;gt;.*)&amp;lt;\/EventId&amp;gt;"
            | search pmt="EEEEEEE"
        ]
    | stats
        ``` first occurrence timestamp of msg_id in search_1 ```
        earliest(eval(case(match(MSG_TYPE, "^C{2}\s+"), _time))) as first_event_epoch,
        ``` first occurrence timestamp of msg_id in search_2 ```
        earliest(eval(case('MSG_TYPE'=="Workflow Start", _time))) as second_event_epoch
            by MSGID1
    ``` calculate the time difference between the msg_id showing up in each search ```
    | eval
        diff_seconds=if(
            ``` if the msg_id didn't show up in the second search but did show up in the first ```
            isnull(second_event_epoch) AND isnotnull(first_event_epoch),
                ``` calculate how long ago from now the msg_id was seen in search_1 ```
                now()-'first_event_epoch',
                ``` msg_id exists in both searches, calculate the time difference between them in seconds ```
                'second_event_epoch'-'first_event_epoch'
            ),
        ``` convert time difference to hours```
        diff_hours='diff_seconds'/(60*60),
        ``` human readable format ```
        duration_seconds=tostring(diff_seconds, "duration")
    ``` filter off everything the has less than a 1 hour difference ```
    | where 'diff_hours'&amp;gt;1&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 20 Dec 2023 16:40:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-can-I-account-for-delay-in-response/m-p/672429#M15656</guid>
      <dc:creator>dtburrows3</dc:creator>
      <dc:date>2023-12-20T16:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: How can I account for delay in response</title>
      <link>https://community.splunk.com/t5/Alerting/How-can-I-account-for-delay-in-response/m-p/672446#M15657</link>
      <description>&lt;P&gt;From what I can tell in testing this over the last few hours this solution works really well. Still testing it out and validating accuracy but so far, it's great. I was actually working on adding duration but you definitely beat me to it.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 18:32:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-can-I-account-for-delay-in-response/m-p/672446#M15657</guid>
      <dc:creator>tkwaller1</dc:creator>
      <dc:date>2023-12-20T18:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: How can I account for delay in response</title>
      <link>https://community.splunk.com/t5/Alerting/How-can-I-account-for-delay-in-response/m-p/672447#M15658</link>
      <description>&lt;P&gt;Awesome! Glad it's working out so far.&amp;nbsp;&lt;BR /&gt;Feel free to leave reply if you run into any issues and I we can try to resolve.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 19:25:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-can-I-account-for-delay-in-response/m-p/672447#M15658</guid>
      <dc:creator>dtburrows3</dc:creator>
      <dc:date>2023-12-20T19:25:44Z</dc:date>
    </item>
  </channel>
</rss>

