<?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: Is it currently possible to somehow create a conditional macro expansion? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-it-currently-possible-to-somehow-create-a-conditional-macro/m-p/640329#M221886</link>
    <description>&lt;P&gt;Nice! A simple solution. Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Apr 2023 08:31:10 GMT</pubDate>
    <dc:creator>shubs</dc:creator>
    <dc:date>2023-04-18T08:31:10Z</dc:date>
    <item>
      <title>Is it currently possible to somehow create a conditional macro expansion?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-currently-possible-to-somehow-create-a-conditional-macro/m-p/635105#M220654</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;Is it currently possible to somehow create a conditional macro expansion?&lt;BR /&gt;&lt;BR /&gt;For example, I have different list of hosts and wanted to expand base the macro argument.&lt;BR /&gt;&lt;BR /&gt;`myhosts(&lt;STRONG&gt;old&lt;/STRONG&gt;)` would expand to&lt;BR /&gt;host=hostname&lt;STRONG&gt;1&lt;/STRONG&gt; OR host=hostname&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;`myhosts(&lt;STRONG&gt;new&lt;/STRONG&gt;)` would expand to&lt;BR /&gt;host=hostname&lt;STRONG&gt;3&lt;/STRONG&gt; OR host=hostname&lt;STRONG&gt;4&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;I looked into different functions to somehow implement it but could not find a solution &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2023 21:55:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-currently-possible-to-somehow-create-a-conditional-macro/m-p/635105#M220654</guid>
      <dc:creator>shubs</dc:creator>
      <dc:date>2023-03-20T21:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Macro Expansion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-currently-possible-to-somehow-create-a-conditional-macro/m-p/635107#M220655</link>
      <description>&lt;P&gt;Macros are just text expansions. You could build the condition into your macro&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;("$select$"=="new" AND (host=="hostA" OR host=="hostB")) OR ("$select$"=="old" AND (host=="hostC" OR host=="hostD"))&lt;/LI-CODE&gt;&lt;P&gt;and use it for example like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where `myhosts("old")`&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 20 Mar 2023 10:16:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-currently-possible-to-somehow-create-a-conditional-macro/m-p/635107#M220655</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-03-20T10:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: Is it currently possible to somehow create a conditional macro expansion?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-currently-possible-to-somehow-create-a-conditional-macro/m-p/640329#M221886</link>
      <description>&lt;P&gt;Nice! A simple solution. Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 08:31:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-currently-possible-to-somehow-create-a-conditional-macro/m-p/640329#M221886</guid>
      <dc:creator>shubs</dc:creator>
      <dc:date>2023-04-18T08:31:10Z</dc:date>
    </item>
  </channel>
</rss>

