<?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: looping a function in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/looping-a-function/m-p/510366#M142842</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/122870"&gt;@nadlurinadluri&lt;/a&gt;&amp;nbsp; if you have created your own custom viz, you can handle color KPI using SPL and assign same color code to entire tree. In the JS Part you can split the value and KPI color and use color for a particular tree and show the values. Similar approach for a different use case (Table cell coloring) is available here:&amp;nbsp;&lt;A href="https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-highlight-a-table-cell-based-on-a-field-of-the-search/td-p/455645" target="_blank"&gt;https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-highlight-a-table-cell-based-on-a-field-of-the-search/td-p/455645&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jul 2020 07:50:35 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2020-07-22T07:50:35Z</dc:date>
    <item>
      <title>looping a function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/looping-a-function/m-p/508245#M142024</link>
      <description>&lt;P&gt;HI Splunkers,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking for some help on loops in splunk. I have a lookup file like below.&lt;BR /&gt;&lt;BR /&gt;from,to&lt;BR /&gt;parent,child1&lt;BR /&gt;parent,child2&lt;BR /&gt;parent,xyz&lt;BR /&gt;child1,son1&lt;BR /&gt;child1,daughter1&lt;BR /&gt;child2,son2&lt;BR /&gt;child2,daughter2&lt;BR /&gt;xyz,kid1&lt;BR /&gt;son1,kid1&lt;BR /&gt;son2,kid2&lt;BR /&gt;&lt;BR /&gt;I want to know all those nodes which has some kind of direct relation (like a network path) to &lt;STRONG&gt;kid1&lt;/STRONG&gt;.. the output should be kid1,son1,child1,parent,xyz&lt;BR /&gt;kid1---&amp;gt; son1&lt;BR /&gt;son1 --&amp;gt;child1&lt;BR /&gt;child1---&amp;gt;parent&lt;BR /&gt;kid1--&amp;gt; xyz&lt;BR /&gt;xyz--&amp;gt; parent&lt;BR /&gt;&lt;BR /&gt;I have the below query which gives me the required output. but as you can see I ran the lookup file multiple times to get the path, but I dont want to do it. I want to have a loop till we reach the end as "Parent" for each node. I know SPLis not a programming language , but curious to know if this is possible. Please help.&lt;BR /&gt;&lt;BR /&gt;| makeresults&lt;BR /&gt;| eval find="kid1"&lt;BR /&gt;| lookup network.csv to AS find output from&lt;BR /&gt;| mvexpand from&lt;BR /&gt;| lookup network.csv to AS from output from AS from1&lt;BR /&gt;| mvexpand from1&lt;BR /&gt;| lookup network.csv to AS from1 output from AS from2&lt;BR /&gt;| mvexpand from2&lt;BR /&gt;| eval newField=find."-".from."-".from1&lt;BR /&gt;| makemv delim="-" newField&lt;BR /&gt;| table newField&lt;BR /&gt;| mvexpand newField&lt;BR /&gt;| dedup newField&lt;BR /&gt;| stats values(newField) As output&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 07:25:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/looping-a-function/m-p/508245#M142024</guid>
      <dc:creator>nadlurinadluri</dc:creator>
      <dc:date>2020-07-09T07:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: looping a function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/looping-a-function/m-p/508345#M142045</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/201110"&gt;@niketn&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/1406"&gt;@woodcock&lt;/a&gt;&amp;nbsp;can you help me here if possible. thanks&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 16:44:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/looping-a-function/m-p/508345#M142045</guid>
      <dc:creator>nadlurinadluri</dc:creator>
      <dc:date>2020-07-09T16:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: looping a function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/looping-a-function/m-p/508379#M142051</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/122870"&gt;@nadlurinadluri&lt;/a&gt;&amp;nbsp;I think what is more important to know is that what do you want to do when you identify parent/child relationship recursively. If this is use case around visualizing the relationship,&amp;nbsp; the original from to data can plug in directly into so many visualizations built for Graph and Relationships. If we have better understanding of your actual use case the visualizations can be converted to the story of your choice. There are several Custom Visualization Apps that you can find on Splunkbase:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;A href="https://splunkbase.splunk.com/app/3112/" target="_self"&gt;Sankey Diagram Custom Visualization&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://splunkbase.splunk.com/app/3137/" target="_self"&gt;Parallel Coordinates - Custom Visualization&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://splunkbase.splunk.com/app/3762/" target="_self"&gt;Network Topology - Custom Visualization&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://splunkbase.splunk.com/app/4611/" target="_self"&gt;3D Graph Network Topology Visualization&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://splunkbase.splunk.com/app/4438/" target="_self"&gt;Network Diagram Viz&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://splunkbase.splunk.com/app/4657/" target="_self"&gt;Flow Map Viz&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://splunkbase.splunk.com/app/4346/" target="_self"&gt;Graph Viz&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://splunkbase.splunk.com/app/3767/" target="_self"&gt;Force Directed App For Splunk&lt;/A&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;And many more &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Following is a run anywhere example with some of the Custom Visualizations from the above list. However each visualization is way more powerful than depicted depending on the Use Case. &lt;STRONG&gt;I have just used the from/to table provided in the question to build these.&lt;/STRONG&gt;&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-center" image-alt="Screen Shot 2020-07-09 at 11.39.37 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/9593iC4F531532131B2A6/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2020-07-09 at 11.39.37 PM.png" alt="Screen Shot 2020-07-09 at 11.39.37 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Following is the Simple XML Code which will work only after respective Custom Visualization is installed.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;dashboard&amp;gt;
  &amp;lt;label&amp;gt;Relationship Mapping&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Sankey&amp;lt;/title&amp;gt;
      &amp;lt;viz type="sankey_diagram_app.sankey_diagram"&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults 
| fields - _time
| eval data="parent,child1;parent,child2;parent,xyz;child1,son1;child1,daughter1;child2,son2;child2,daughter2;xyz,kid1;son1,kid1;son2,kid2" 
| makemv data delim=";" 
| mvexpand data 
| makemv data delim="," 
| eval from=mvindex(data,0), to=mvindex(data,1)
| fields from to&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="height"&amp;gt;394&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.enabled"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.scales.shared"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.size"&amp;gt;medium&amp;lt;/option&amp;gt;
      &amp;lt;/viz&amp;gt;
    &amp;lt;/panel&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Parallel Coordinates&amp;lt;/title&amp;gt;
      &amp;lt;viz type="parallel_coordinates_app.parallel_coordinates"&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults 
| fields - _time
| eval data="parent,child1;parent,child2;parent,xyz;child1,son1;child1,daughter1;child2,son2;child2,daughter2;xyz,kid1;son1,kid1;son2,kid2" 
| makemv data delim=";" 
| mvexpand data 
| makemv data delim="," 
| eval from=mvindex(data,0), to=mvindex(data,1)
| table from to&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="height"&amp;gt;393&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.enabled"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.scales.shared"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.size"&amp;gt;medium&amp;lt;/option&amp;gt;
      &amp;lt;/viz&amp;gt;
    &amp;lt;/panel&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Force Directed Visualization&amp;lt;/title&amp;gt;
      &amp;lt;viz type="force_directed_viz.force_directed"&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults 
| fields - _time
| eval data="parent,child1;parent,child2;parent,xyz;child1,son1;child1,daughter1;child2,son2;child2,daughter2;xyz,kid1;son1,kid1;son2,kid2" 
| makemv data delim=";" 
| mvexpand data 
| makemv data delim="," 
| eval from=mvindex(data,0), to=mvindex(data,1)
| fields from to&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="height"&amp;gt;396&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.enabled"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.scales.shared"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.size"&amp;gt;medium&amp;lt;/option&amp;gt;
      &amp;lt;/viz&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Flow Map Viz&amp;lt;/title&amp;gt;
      &amp;lt;viz type="flow_map_viz.flow_map_viz"&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults 
| fields - _time
| eval data="parent,child1;parent,child2;parent,xyz;child1,son1;child1,daughter1;child2,son2;child2,daughter2;xyz,kid1;son1,kid1;son2,kid2" 
| makemv data delim=";" 
| mvexpand data 
| makemv data delim="," 
| eval from=mvindex(data,0), to=mvindex(data,1)
| fields from to&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="height"&amp;gt;354&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.enabled"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.scales.shared"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.size"&amp;gt;medium&amp;lt;/option&amp;gt;
      &amp;lt;/viz&amp;gt;
    &amp;lt;/panel&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Network Diagram Viz&amp;lt;/title&amp;gt;
      &amp;lt;viz type="network-diagram-viz.network-diagram-viz"&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults 
| fields - _time
| eval data="parent,child1;parent,child2;parent,xyz;child1,son1;child1,daughter1;child2,son2;child2,daughter2;xyz,kid1;son1,kid1;son2,kid2" 
| makemv data delim=";" 
| mvexpand data 
| makemv data delim="," 
| eval from=mvindex(data,0), to=mvindex(data,1)
| eval value=from
| fields from to value&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="height"&amp;gt;351&amp;lt;/option&amp;gt;
        &amp;lt;option name="network-diagram-viz.network-diagram-viz.arrowLocation"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="network-diagram-viz.network-diagram-viz.canZoom"&amp;gt;true&amp;lt;/option&amp;gt;
        &amp;lt;option name="network-diagram-viz.network-diagram-viz.clusterBy"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="network-diagram-viz.network-diagram-viz.defaultNodeType"&amp;gt;circle&amp;lt;/option&amp;gt;
        &amp;lt;option name="network-diagram-viz.network-diagram-viz.draggableNodes"&amp;gt;true&amp;lt;/option&amp;gt;
        &amp;lt;option name="network-diagram-viz.network-diagram-viz.enablePhysics"&amp;gt;true&amp;lt;/option&amp;gt;
        &amp;lt;option name="network-diagram-viz.network-diagram-viz.hierarchy"&amp;gt;true&amp;lt;/option&amp;gt;
        &amp;lt;option name="network-diagram-viz.network-diagram-viz.hierarchyDirection"&amp;gt;Top-Down&amp;lt;/option&amp;gt;
        &amp;lt;option name="network-diagram-viz.network-diagram-viz.hierarchySortMethod"&amp;gt;directed&amp;lt;/option&amp;gt;
        &amp;lt;option name="network-diagram-viz.network-diagram-viz.linkTextLocation"&amp;gt;bottom&amp;lt;/option&amp;gt;
        &amp;lt;option name="network-diagram-viz.network-diagram-viz.linkTextSize"&amp;gt;medium&amp;lt;/option&amp;gt;
        &amp;lt;option name="network-diagram-viz.network-diagram-viz.nodeTextSize"&amp;gt;medium&amp;lt;/option&amp;gt;
        &amp;lt;option name="network-diagram-viz.network-diagram-viz.smoothEdgeType"&amp;gt;dynamic&amp;lt;/option&amp;gt;
        &amp;lt;option name="network-diagram-viz.network-diagram-viz.smoothEdges"&amp;gt;true&amp;lt;/option&amp;gt;
        &amp;lt;option name="network-diagram-viz.network-diagram-viz.tokenNode"&amp;gt;nd_node_token&amp;lt;/option&amp;gt;
        &amp;lt;option name="network-diagram-viz.network-diagram-viz.tokenToNode"&amp;gt;nd_to_node_token&amp;lt;/option&amp;gt;
        &amp;lt;option name="network-diagram-viz.network-diagram-viz.tokenToolTip"&amp;gt;nd_tooltip_token&amp;lt;/option&amp;gt;
        &amp;lt;option name="network-diagram-viz.network-diagram-viz.tokenValue"&amp;gt;nd_value_token&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.enabled"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.scales.shared"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.size"&amp;gt;medium&amp;lt;/option&amp;gt;
      &amp;lt;/viz&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 18:40:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/looping-a-function/m-p/508379#M142051</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-07-09T18:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: looping a function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/looping-a-function/m-p/508432#M142065</link>
      <description>&lt;P&gt;Awesome, thanks for the graphs!! Really Appreciate it.&lt;BR /&gt;&lt;BR /&gt;Also, I have built a similar one (network graph) on react web framework. The reason I am requesting for that particular data is, if at all something happens to the node (say &lt;STRONG&gt;kid1&lt;/STRONG&gt;) I am able to assign a color red to it (by passing a new column ofcourse). In a similar way, I want to find out the parent-child relationship data and convert all of them into red. So I just need to add a search which takes kid1 as red, and gives xyz,child1,son1,parent as red too.&lt;BR /&gt;&lt;BR /&gt;I was able to achieve this using js in my code, but personally I dont like doing any data operations outside of Splunk. Hence trying to figure out how to get this recursive loop function and get the expected output.&lt;/P&gt;&lt;P&gt;Below is a high level view of how I am planning to get the output as. Changing just the color of kid1 is possible, but I am unable to get the info till parent. Do you think that can be achieved?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nadlurinadluri_0-1594353164567.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/9599i69A46EA23DD0EB06/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nadlurinadluri_0-1594353164567.png" alt="nadlurinadluri_0-1594353164567.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jul 2020 03:54:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/looping-a-function/m-p/508432#M142065</guid>
      <dc:creator>nadlurinadluri</dc:creator>
      <dc:date>2020-07-10T03:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: looping a function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/looping-a-function/m-p/510366#M142842</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/122870"&gt;@nadlurinadluri&lt;/a&gt;&amp;nbsp; if you have created your own custom viz, you can handle color KPI using SPL and assign same color code to entire tree. In the JS Part you can split the value and KPI color and use color for a particular tree and show the values. Similar approach for a different use case (Table cell coloring) is available here:&amp;nbsp;&lt;A href="https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-highlight-a-table-cell-based-on-a-field-of-the-search/td-p/455645" target="_blank"&gt;https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-highlight-a-table-cell-based-on-a-field-of-the-search/td-p/455645&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 07:50:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/looping-a-function/m-p/510366#M142842</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-07-22T07:50:35Z</dc:date>
    </item>
  </channel>
</rss>

