<?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 correlate nested parent child jobs? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/639223#M221489</link>
    <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/49493"&gt;@tscroggins&lt;/a&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;Thanks but this is not going to work.&amp;nbsp; Its not that simple.&amp;nbsp; we can't combine everything.&amp;nbsp;Example is just subset there are multiple nested jobs. Also there is not end time.&lt;/P&gt;</description>
    <pubDate>Fri, 07 Apr 2023 16:18:12 GMT</pubDate>
    <dc:creator>AKG11</dc:creator>
    <dc:date>2023-04-07T16:18:12Z</dc:date>
    <item>
      <title>How to correlate nested parent child jobs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/638978#M221407</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;we have to monitor some jobs in which One Job could have multiple sub task.&amp;nbsp; It could be nested dependency as well.&amp;nbsp; One task depended on other and that other dependent on some other....&lt;BR /&gt;&lt;BR /&gt;I am looking to correlate these dependency and want to see how much time job took end to end.&lt;BR /&gt;&lt;BR /&gt;In below example.&amp;nbsp;&lt;BR /&gt;1st task dependent on 2nd, 2nd dependent on 3rd, 4th is End of task.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AKG11_0-1680770961762.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/24810i0364999AB89BF23C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AKG11_0-1680770961762.png" alt="AKG11_0-1680770961762.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 19:13:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/638978#M221407</guid>
      <dc:creator>AKG11</dc:creator>
      <dc:date>2023-04-06T19:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to correlate nested parent child jobs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/639204#M221481</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If the start and finish times are in the search results and you only need the total duration, you can use the stats range function to calculate the duration in seconds:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;...
| stats min(_time) as start_time max(_time) as finish_time range(_time) as duration
| fieldformat start_time=strftime(start_time, "%F %T")
| fieldformat finish_time=strftime(finish_time, "%F %T")
| fieldformat duration=tostring(duration, "duration")&lt;/LI-CODE&gt;&lt;P&gt;If you need to know the critical/longest path through the job network, the solution is more involved.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2023 13:38:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/639204#M221481</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2023-04-07T13:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to correlate nested parent child jobs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/639223#M221489</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/49493"&gt;@tscroggins&lt;/a&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;Thanks but this is not going to work.&amp;nbsp; Its not that simple.&amp;nbsp; we can't combine everything.&amp;nbsp;Example is just subset there are multiple nested jobs. Also there is not end time.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2023 16:18:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/639223#M221489</guid>
      <dc:creator>AKG11</dc:creator>
      <dc:date>2023-04-07T16:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to correlate nested parent child jobs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/639261#M221500</link>
      <description>&lt;P&gt;In that case, we'll need to see a larger sample dataset (deidentified if necessary). If neither the finish times nor the durations are known, what method have you been using to manually calculate the makespan / end-to-end duration?&lt;/P&gt;</description>
      <pubDate>Sat, 08 Apr 2023 04:37:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/639261#M221500</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2023-04-08T04:37:19Z</dc:date>
    </item>
    <item>
      <title>Correlating Nested Parent Child jobs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/639391#M221537</link>
      <description>&lt;P&gt;I don't think there's an easy way to do that. It's one of the anti-patterns in data - to try to normalize everything. The similar case is when someone implements a tree structure (for example to have a filesystem-like objects) with simply a "pointer" to a parent in SQL database.&lt;/P&gt;&lt;P&gt;It requires a recursive processing to find the path to the root.&lt;/P&gt;&lt;P&gt;And while in some flavours of SQL you can make a strored procedure which will do that for you (it will still not be very effective mind you), Splunk has no way of "looping" over own results and "re-searching" based on those results.&lt;/P&gt;&lt;P&gt;The only - very ugly - "quasi-solution" would be to assume that your jobs cannot be nested more than N-levels and just do N iterations of mapping a job to its parent.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 17:14:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/639391#M221537</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-04-10T17:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: Correlating Nested Parent Child jobs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/639411#M221544</link>
      <description>&lt;P&gt;Where supported, common table expressions make trees manageable in relational databases. Graph databases make trees trivial. The problem isn't intractable in Splunk; it's just different.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 19:10:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/639411#M221544</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2023-04-10T19:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: Correlating Nested Parent Child jobs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/639426#M221551</link>
      <description>&lt;P&gt;CTEs are not your common SQL. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And with your basic SQL it's very annoying to operate on tree-like structures in SQL. I had to do it in ASE 11.9.2 so I know what I'm talking about. Good thing it has stored procedures. MySQL at that time didnt &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 20:21:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/639426#M221551</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-04-10T20:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: Correlating Nested Parent Child jobs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/639427#M221552</link>
      <description>&lt;P&gt;I used CTEs in ad hoc T-SQL (and less often, CONNECT BY in Oracle) for critical path analysis. It worked very well on indexed identifier and dependency columns. Translating relational SQL solutions to streaming Splunk solutions made up the bulk of my early Splunk experience. I do much less of that now, although the background helps when working with clients on DB Connect solutions, particularly with "UPSERT" style audit tables and normalized, often undocumented third-party schemas.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 20:37:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/639427#M221552</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2023-04-10T20:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: Correlating Nested Parent Child jobs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/639457#M221559</link>
      <description>&lt;P&gt;Good pointer. &amp;nbsp;In fact, I started with two levels (as the screenshot shows):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval u_key = if(isnull(key), parent_key, key)
| transaction u_key startswith="eval(isnull(key))" endswith="eval(isnull(parent_key) OR key == u_key)" keepevicted=true
| foreach parent_key mode=multivalue
    [eval uu_key = mvappend(uu_key, if(mvcount(parent_key) &amp;lt; 2, &amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt;, if(key == &amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt;, null(), &amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt;)))]
| eval _time = if(u_key == uu_key, _time, _time + duration)
| rename duration as duration1
| transaction uu_key startswith="eval(key!=uu_key)" endswith="eval(key==uu_key)" keepevicted=true
| eval duration = sum(duration1) + duration&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, I realize that each additional nest requires an additional explicit compaction. &amp;nbsp;Very ugly indeed.&lt;/P&gt;&lt;P&gt;Anyway, here is an emulated dataset to test the above:&lt;/P&gt;&lt;TABLE width="296px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="165.125px"&gt;_time&lt;/TD&gt;&lt;TD width="59px"&gt;key&lt;/TD&gt;&lt;TD width="70.890625px"&gt;parent_key&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="165.125px"&gt;2023-03-29 07:26:00&lt;/TD&gt;&lt;TD width="59px"&gt;67890&lt;/TD&gt;&lt;TD width="70.890625px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="165.125px"&gt;2023-03-29 07:06:00&lt;/TD&gt;&lt;TD width="59px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="70.890625px"&gt;67890&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="165.125px"&gt;2023-03-29 06:30:00&lt;/TD&gt;&lt;TD width="59px"&gt;12345&lt;/TD&gt;&lt;TD width="70.890625px"&gt;67890&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="165.125px"&gt;2023-03-29 06:04:00&lt;/TD&gt;&lt;TD width="59px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="70.890625px"&gt;12345&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Speaking of test dataset, the OP should always provide that in text. &amp;nbsp;Screenshot is very unhelpful.&lt;/P&gt;&lt;P&gt;The output would look like&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;_time&lt;/TD&gt;&lt;TD&gt;closed_txn&lt;/TD&gt;&lt;TD&gt;duration&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;duration1&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;eventcount&lt;/TD&gt;&lt;TD&gt;field_match_sum&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;key&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;parent_key&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;u_key&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;uu_key&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2023-03-29 06:30:00&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;4920&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;1200&lt;/DIV&gt;&lt;DIV class=""&gt;1560&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;12345&lt;/DIV&gt;&lt;DIV class=""&gt;67890&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;12345&lt;/DIV&gt;&lt;DIV class=""&gt;67890&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;12345&lt;/DIV&gt;&lt;DIV class=""&gt;67890&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;67890&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 11 Apr 2023 07:18:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/639457#M221559</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-04-11T07:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: Correlating Nested Parent Child jobs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/639458#M221560</link>
      <description>&lt;P&gt;As I said - sometimes it can be done, sometimes it cannot. CTEs are not part of the SQL-92, recursive queries were added in SQL:1999. Some DBs started implementing them relatively recently. But we're getting sidetracked here. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;With Splunk you have no recursion unless you try to do some very very very ugly (and hardly maintainable) stuff. So I'd say that the original requirement is not fulfillable by Splunk in its raw form.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 07:28:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/639458#M221560</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-04-11T07:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to correlate nested parent child jobs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/639545#M221598</link>
      <description>&lt;P&gt;There is going to be homework here but I will give you an analogous problem with solution that you can adapt to your data.&amp;nbsp; First, install The "CIM Toolkit" app (it has a TON of great stuff in it):&lt;BR /&gt;&lt;A href="https://splunkbase.splunk.com/app/6243" target="_blank" rel="noopener"&gt;https://splunkbase.splunk.com/app/6243&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Next, run this search:&lt;BR /&gt;| `CIM_Toolkit_Generate_Renames(Authentication)`&lt;BR /&gt;&lt;BR /&gt;Then do Shift-Ctrl-E to Expand the macro into SPL.&amp;nbsp; Tear it apart and take what you need.&lt;BR /&gt;&lt;BR /&gt;Here is why it will do what you need&amp;nbsp; It starts out with data like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;title child1 objectName parentName&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Authentication&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Authentication&lt;/TD&gt;&lt;TD&gt;BaseEvent&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Authentication&lt;/TD&gt;&lt;TD&gt;Default_Authentication&lt;/TD&gt;&lt;TD&gt;Authentication&lt;/TD&gt;&lt;TD&gt;BaseEvent&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Authentication&lt;/TD&gt;&lt;TD&gt;Failed_Authentication&lt;/TD&gt;&lt;TD&gt;Authentication&lt;/TD&gt;&lt;TD&gt;BaseEvent&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Authentication&lt;/TD&gt;&lt;TD&gt;Insecure_Authentication&lt;/TD&gt;&lt;TD&gt;Authentication&lt;/TD&gt;&lt;TD&gt;BaseEvent&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Authentication&lt;/TD&gt;&lt;TD&gt;Privileged_Authentication&lt;/TD&gt;&lt;TD&gt;Authentication&lt;/TD&gt;&lt;TD&gt;BaseEvent&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Authentication&lt;/TD&gt;&lt;TD&gt;Successful_Authentication&lt;/TD&gt;&lt;TD&gt;Authentication&lt;/TD&gt;&lt;TD&gt;BaseEvent&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;And transforms it into a final output like this:&lt;BR /&gt;&lt;SPAN&gt;| rename Authentication.Successful_Authentication.* AS *&lt;BR /&gt;| rename Authentication.Privileged_Authentication.Successful_Privileged_Authentication.* AS *&lt;BR /&gt;| rename Authentication.Privileged_Authentication.Failed_Privileged_Authentication.* AS *&lt;BR /&gt;| rename Authentication.Privileged_Authentication.* AS *&lt;BR /&gt;| rename Authentication.Insecure_Authentication.* AS *&lt;BR /&gt;| rename Authentication.Failed_Authentication.* AS *&lt;BR /&gt;| rename Authentication.Default_Authentication.Successful_Default_Authentication.* AS *&lt;BR /&gt;| rename Authentication.Default_Authentication.Failed_Default_Authentication.* AS *&lt;BR /&gt;| rename Authentication.Default_Authentication.* AS *&lt;BR /&gt;| rename Authentication.* AS *&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 19:52:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-nested-parent-child-jobs/m-p/639545#M221598</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2023-04-11T19:52:28Z</dc:date>
    </item>
  </channel>
</rss>

