<?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 macro invocation fails in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Recursive-macro-invocation-fails-Is-there-a-different-solution/m-p/604757#M210331</link>
    <description>&lt;P&gt;Many thx, ITWhisperer, works absolutely fine &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jul 2022 13:24:24 GMT</pubDate>
    <dc:creator>eherbst63</dc:creator>
    <dc:date>2022-07-07T13:24:24Z</dc:date>
    <item>
      <title>Recursive macro invocation fails- Is there a different solution besides defining all possible list values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Recursive-macro-invocation-fails-Is-there-a-different-solution/m-p/604734#M210323</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;I have the following issue: within a search and a data field I find values like this:&lt;/P&gt;
&lt;P&gt;db2_stat = "1,3:8"&lt;BR /&gt;db2_stat = "2,5:7"&lt;/P&gt;
&lt;P&gt;My issue now is this should be translated into a comma separated list of all values starting with the value on the left side of the colon, ending with the value on the right side. In other words: the resulting data field should look like this:&lt;/P&gt;
&lt;P&gt;db2_stat_xlated = "1,3,4,5,6,7,8"&lt;BR /&gt;db2_stat_xlated = "2,5,6,7"&lt;/P&gt;
&lt;P&gt;I thought, I'd write a macro that calls recursively until the start value reaches end value. But whatever I've tried I ended up with the message&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"&lt;SPAN&gt;Error in 'SearchParser': Reached maximum recursion depth (100) while expanding macros. Check for infinitely recursive macro definitions.".&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Last version of the macro code&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;| eval st_v = $start_v$, ed_v = $end_v$, value_list = $val$&lt;BR /&gt;| eval nx_v = st_v + 1&lt;BR /&gt;| eval value_list = case(st_v &amp;lt; ed_v, value_list . st_v . "," . `GEN_VALUE_LIST(nx_v, ed_v, value_list)`,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;st_v == ed_v, value_list . st_v,&lt;BR /&gt;                         1==1, value_list)&lt;/PRE&gt;
&lt;DIV&gt;&lt;STRONG&gt;The macro definition&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;GEN_VALUE_LIST(3) with these arguments&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;PRE&gt;start_v, end_v, val&lt;/PRE&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;Query to test&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;PRE&gt;| makeresults&lt;BR /&gt;`GEN_VALUE_LIST(3,6,"1,")`&lt;BR /&gt;| table *&lt;/PRE&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Although I'm keen to understand SPLUNK's issue with it (code transferred to perl language works) I'd mostly appreciate a working solution beyond defining all possible list values in a lookup file &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Many thanks in advance,&lt;/DIV&gt;
&lt;DIV&gt;Ekke&lt;/DIV&gt;</description>
      <pubDate>Thu, 07 Jul 2022 14:11:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Recursive-macro-invocation-fails-Is-there-a-different-solution/m-p/604734#M210323</guid>
      <dc:creator>eherbst63</dc:creator>
      <dc:date>2022-07-07T14:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive macro invocation fails</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Recursive-macro-invocation-fails-Is-there-a-different-solution/m-p/604747#M210330</link>
      <description>&lt;LI-CODE lang="markup"&gt;| rex field=db2_stat "(?&amp;lt;initial&amp;gt;\d+),(?&amp;lt;start&amp;gt;\d+):(?&amp;lt;end&amp;gt;\d+)"
| eval db2_stat_xlated=initial.",".mvjoin(mvrange(start, end+1),",")&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 07 Jul 2022 12:48:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Recursive-macro-invocation-fails-Is-there-a-different-solution/m-p/604747#M210330</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-07-07T12:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive macro invocation fails</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Recursive-macro-invocation-fails-Is-there-a-different-solution/m-p/604757#M210331</link>
      <description>&lt;P&gt;Many thx, ITWhisperer, works absolutely fine &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 13:24:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Recursive-macro-invocation-fails-Is-there-a-different-solution/m-p/604757#M210331</guid>
      <dc:creator>eherbst63</dc:creator>
      <dc:date>2022-07-07T13:24:24Z</dc:date>
    </item>
  </channel>
</rss>

