<?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: Recursive search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Recursive-search/m-p/361173#M165892</link>
    <description>&lt;P&gt;Hi DalJeanis,&lt;/P&gt;

&lt;P&gt;I think your answer is a step in the right direction.  I didn't give you all the details though (sorry thats my fault)&lt;/P&gt;

&lt;P&gt;The final version of this needs to produce a chart that looks like the attached.  What is happening is there are some devices that are "flapping" (i.e. com(fail), then comRes over and over throwing off the chart) that need to be eliminated, which is what your query does (thank you!) but as a result I'm missing the remaining data get the graph built properly.&lt;/P&gt;</description>
    <pubDate>Thu, 28 Sep 2017 17:54:52 GMT</pubDate>
    <dc:creator>dbcase</dc:creator>
    <dc:date>2017-09-28T17:54:52Z</dc:date>
    <item>
      <title>Recursive search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Recursive-search/m-p/361171#M165890</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have this data&lt;BR /&gt;
    2017-09-27 15:56:42 ID="108065999", PREMISE_FK="1004152", EVENT_TYPE="Camera Trouble", EVENT_SUB_TYPE="com"&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2017-09-27 15:56:45 ID="108065999", PREMISE_FK="1004152", EVENT_TYPE="Camera Trouble", EVENT_SUB_TYPE="comRes"

2017-09-27 15:56:42 ID="108065671", PREMISE_FK="1001566", EVENT_TYPE="Camera Trouble", EVENT_SUB_TYPE="com"



Goes on for 4500 events
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Event #1 is a communication failure for a given premise ID&lt;BR /&gt;
Event #2 is a communication restore for the same premise ID in event #1&lt;BR /&gt;
Event #3 is a communication failure for a different premise ID&lt;/P&gt;

&lt;P&gt;If there is a failure and a subsequent restore I want to ignore it, but if there is a failure without a subsequent restore (Event #3) I want to report on it?  How would I go about getting a premise ID and searching the same event log for each premise ID??&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:58:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Recursive-search/m-p/361171#M165890</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2020-09-29T15:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Recursive-search/m-p/361172#M165891</link>
      <description>&lt;P&gt;@dbcase - It is almost always a bad idea to think in terms of recursion in splunk.  &lt;/P&gt;

&lt;P&gt;In these cases, you usually need to think in terms of sequence.  Select all the records you need, sort them in forward or backwards time order, and use &lt;CODE&gt;streamstats&lt;/CODE&gt; to copy the information you need forward or backwards onto the records.   Alternately, you can often use &lt;CODE&gt;eventstats&lt;/CODE&gt; to copy group information among a group of records without losing the individual records. &lt;/P&gt;

&lt;P&gt;In this case, however, due to the simple record format, clear key structure, and basic requirements, a plain&lt;CODE&gt;stats&lt;/CODE&gt; will get you what you need.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your search that gets the records  where EVENT_TYPE="Camera Trouble"
| stats max(_time) as Time 
        max(eval(case(EVENT_SUB_TYPE="com",_time))) as comTime 
        max(eval(case(EVENT_SUB_TYPE="comRes",_time))) as resTime 
   by ID PREMISE_FK  
| where isnull(resTime) OR resTime&amp;lt;comTime
| rename Time as _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Sep 2017 14:54:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Recursive-search/m-p/361172#M165891</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-09-28T14:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Recursive-search/m-p/361173#M165892</link>
      <description>&lt;P&gt;Hi DalJeanis,&lt;/P&gt;

&lt;P&gt;I think your answer is a step in the right direction.  I didn't give you all the details though (sorry thats my fault)&lt;/P&gt;

&lt;P&gt;The final version of this needs to produce a chart that looks like the attached.  What is happening is there are some devices that are "flapping" (i.e. com(fail), then comRes over and over throwing off the chart) that need to be eliminated, which is what your query does (thank you!) but as a result I'm missing the remaining data get the graph built properly.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 17:54:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Recursive-search/m-p/361173#M165892</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2017-09-28T17:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Recursive-search/m-p/361174#M165893</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3562i645679A7F8CF889A/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 17:55:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Recursive-search/m-p/361174#M165893</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2017-09-28T17:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Recursive-search/m-p/361175#M165894</link>
      <description>&lt;P&gt;@dbcase - okay, I'll answer this new part on the other question.  Please accept the answer to close this question.  &lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2017 18:08:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Recursive-search/m-p/361175#M165894</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-09-29T18:08:13Z</dc:date>
    </item>
  </channel>
</rss>

