<?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: foreach on REST endpoint data in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/Help-with-foreach-on-REST-endpoint-data/m-p/615396#M14083</link>
    <description>&lt;P&gt;You're very close.&amp;nbsp; The &lt;FONT face="courier new,courier"&gt;&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;&lt;/FONT&gt; specifier should be enclosed in single quotes so Splunk treats "EVAL-action" as a field name instead of an expression.&amp;nbsp; Also, &lt;FONT face="courier new,courier"&gt;&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;&lt;/FONT&gt; should be in double quotes so the string "action" rather than the non-existent field 'action' is appended to eval_fields.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rest splunk_server=local /servicesNS/-/-/configs/conf-props 
| fields title EVAL-a* 
| eval eval_fields="" 
| foreach EVAL-*
    [ eval eval_fields=if(isnotnull('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'), mvappend(eval_fields,"&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;"), eval_fields) ] 
| table title eval_fields *&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 30 Sep 2022 13:39:54 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2022-09-30T13:39:54Z</dc:date>
    <item>
      <title>Help with foreach on REST endpoint data</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Help-with-foreach-on-REST-endpoint-data/m-p/615384#M14078</link>
      <description>&lt;P&gt;I'm trying to get a list of fields by sourcetype without going down the route of fieldsummary and thought analyzing the props configs would be a good place to start.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I'm starting with EVAL generated fields but not having any luck on the foreach section.&lt;BR /&gt;Any pointers would be much appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| rest splunk_server=local /servicesNS/-/-/configs/conf-props 
| table title EVAL-a* 
| eval eval_fields="" 
| foreach EVAL-* 
    [ eval eval_fields=if(isnotnull(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;), mvappend(eval_fields,'&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;'), eval_fields) ] 
| table title eval_fields *&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 14:33:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Help-with-foreach-on-REST-endpoint-data/m-p/615384#M14078</guid>
      <dc:creator>andrew_nelson</dc:creator>
      <dc:date>2022-09-30T14:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: foreach on REST endpoint data</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Help-with-foreach-on-REST-endpoint-data/m-p/615392#M14080</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/229311"&gt;@andrew_nelson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please try this in foreach?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[ eval eval_fields= if(isnotnull('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'), mvappend(eval_fields,"&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;"), eval_fields) ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this will help you.&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;KV&lt;BR /&gt;If any of my replies help you to solve the problem Or gain knowledge, an upvote would be appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 13:25:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Help-with-foreach-on-REST-endpoint-data/m-p/615392#M14080</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2022-09-30T13:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: foreach on REST endpoint data</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Help-with-foreach-on-REST-endpoint-data/m-p/615394#M14081</link>
      <description>&lt;P&gt;You're a legend KV&amp;nbsp; ! Thanks a million.&lt;BR /&gt;Been annoying me all day trying to figure out this.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 13:29:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Help-with-foreach-on-REST-endpoint-data/m-p/615394#M14081</guid>
      <dc:creator>andrew_nelson</dc:creator>
      <dc:date>2022-09-30T13:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: foreach on REST endpoint data</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Help-with-foreach-on-REST-endpoint-data/m-p/615395#M14082</link>
      <description>&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_heart_eyes:"&gt;😍&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 13:31:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Help-with-foreach-on-REST-endpoint-data/m-p/615395#M14082</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2022-09-30T13:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: foreach on REST endpoint data</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Help-with-foreach-on-REST-endpoint-data/m-p/615396#M14083</link>
      <description>&lt;P&gt;You're very close.&amp;nbsp; The &lt;FONT face="courier new,courier"&gt;&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;&lt;/FONT&gt; specifier should be enclosed in single quotes so Splunk treats "EVAL-action" as a field name instead of an expression.&amp;nbsp; Also, &lt;FONT face="courier new,courier"&gt;&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;&lt;/FONT&gt; should be in double quotes so the string "action" rather than the non-existent field 'action' is appended to eval_fields.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rest splunk_server=local /servicesNS/-/-/configs/conf-props 
| fields title EVAL-a* 
| eval eval_fields="" 
| foreach EVAL-*
    [ eval eval_fields=if(isnotnull('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'), mvappend(eval_fields,"&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;"), eval_fields) ] 
| table title eval_fields *&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 13:39:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Help-with-foreach-on-REST-endpoint-data/m-p/615396#M14083</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-09-30T13:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: foreach on REST endpoint data</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Help-with-foreach-on-REST-endpoint-data/m-p/615400#M14085</link>
      <description>&lt;P&gt;Thanks Rich. I was thinking along the lines of putting anything in double quotes would be interpreted literally so &amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt; would have ended up in my multivalue field.&amp;nbsp;&lt;BR /&gt;Thanks for the detailed explanation.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 14:01:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Help-with-foreach-on-REST-endpoint-data/m-p/615400#M14085</guid>
      <dc:creator>andrew_nelson</dc:creator>
      <dc:date>2022-09-30T14:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: foreach on REST endpoint data</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Help-with-foreach-on-REST-endpoint-data/m-p/615402#M14086</link>
      <description>&lt;P&gt;Understood.&amp;nbsp; Like $tokens$ in dashboards and the &lt;FONT face="courier new,courier"&gt;map&lt;/FONT&gt; command, &amp;lt;&amp;lt;tokens&amp;gt;&amp;gt; in &lt;FONT face="courier new,courier"&gt;foreach&lt;/FONT&gt; are always expanded, even when quoted.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 14:12:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Help-with-foreach-on-REST-endpoint-data/m-p/615402#M14086</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-09-30T14:12:43Z</dc:date>
    </item>
  </channel>
</rss>

