<?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: Using Wildcard as value in a variable in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410645#M118510</link>
    <description>&lt;P&gt;Try it yourself; test this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_* 
| search sourcetype="splunk*"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Against this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_* 
| where sourcetype="splunk*"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_* 
| where like(sourcetype, "splunk*")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You are talking about the last one, I am talking about the first 2.  Your initial search absolutely should have worked.&lt;/P&gt;</description>
    <pubDate>Fri, 18 Jan 2019 18:27:56 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-01-18T18:27:56Z</dc:date>
    <item>
      <title>Using Wildcard as value in a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410633#M118498</link>
      <description>&lt;P&gt;Is there any way to use a wildcard as a value to a variable?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup Functionalities.csv
| search AppNo=$app$
| eval Functionality=AppNo.".".FuncNo." - ".Functionality
| sort Functionality
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;$app$&lt;/CODE&gt; has value of &lt;CODE&gt;*&lt;/CODE&gt; sometimes, or it might have a number.  It works with all numbers, or if i type search &lt;CODE&gt;AppNo="*"&lt;/CODE&gt;, but not when &lt;CODE&gt;$App$=*&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I've tried &lt;CODE&gt;match()&lt;/CODE&gt;, &lt;CODE&gt;like()&lt;/CODE&gt;, nothing works.&lt;/P&gt;

&lt;P&gt;How can i use a variable's wildcard value as a wildcard?&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2019 23:08:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410633#M118498</guid>
      <dc:creator>weidertc</dc:creator>
      <dc:date>2019-01-16T23:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: Using Wildcard as value in a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410634#M118499</link>
      <description>&lt;P&gt;this reputation crap is terrible.  i can't correct the above to html encode the asterisk.  please re-read the value of $app$ as "*"&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2019 23:12:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410634#M118499</guid>
      <dc:creator>weidertc</dc:creator>
      <dc:date>2019-01-16T23:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using Wildcard as value in a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410635#M118500</link>
      <description>&lt;P&gt;Can you try  your search like this &lt;BR /&gt;
    |search AppNo = “$app$”&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 02:48:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410635#M118500</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2019-01-17T02:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using Wildcard as value in a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410636#M118501</link>
      <description>&lt;P&gt;I fixed it for you.  You do not need HTML.  Read the &lt;CODE&gt;markup&lt;/CODE&gt; link over on the right side.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 04:15:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410636#M118501</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-17T04:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using Wildcard as value in a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410637#M118502</link>
      <description>&lt;P&gt;I do not understand what the problem is.  I do this all the time and if you do:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...  | search AppNo="$app$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where &lt;CODE&gt;$app$&lt;/CODE&gt; contains stuff like &lt;CODE&gt;*&lt;/CODE&gt; or &lt;CODE&gt;microsoft*&lt;/CODE&gt; or &lt;CODE&gt;*micro*&lt;/CODE&gt; and it works just fine.  What is the probelm?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 04:18:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410637#M118502</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-17T04:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: Using Wildcard as value in a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410638#M118503</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
You can try putting your token in " ". So your search should look like &lt;BR /&gt;
...| search AppNo="$app$" &lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 07:19:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410638#M118503</guid>
      <dc:creator>nikita_p</dc:creator>
      <dc:date>2019-01-17T07:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using Wildcard as value in a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410639#M118504</link>
      <description>&lt;P&gt;thanks!  that works better.  apparently i can ask a question but not edit it right after.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 14:30:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410639#M118504</guid>
      <dc:creator>weidertc</dc:creator>
      <dc:date>2019-01-17T14:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using Wildcard as value in a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410640#M118505</link>
      <description>&lt;P&gt;perhaps it is related to the version of splunk.  luckily this is a simple test so i can attest this does not work on our version 6.6.10.2b5f6c3d5f96&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 14:32:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410640#M118505</guid>
      <dc:creator>weidertc</dc:creator>
      <dc:date>2019-01-17T14:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using Wildcard as value in a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410641#M118506</link>
      <description>&lt;P&gt;I tried this as well.  I have found a workaround using like() that I will post, but it has the double " that you mention as necessary.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 14:32:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410641#M118506</guid>
      <dc:creator>weidertc</dc:creator>
      <dc:date>2019-01-17T14:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using Wildcard as value in a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410642#M118507</link>
      <description>&lt;P&gt;I got this working using where like(), which requires double quotes and %.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup Functionalities.csv
| where like(AppNo, "$app$")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;$app$ can contain a number or a % and it will pull either the entire csv or a subset of it.&lt;/P&gt;

&lt;P&gt;For those where a * value works, that is certainly easier, but for me, for some unknown reason, wildcard asterisks act as literals when its a value of a variable.  If this is the case for you, this is a 2nd way to write it.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 14:37:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410642#M118507</guid>
      <dc:creator>weidertc</dc:creator>
      <dc:date>2019-01-17T14:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using Wildcard as value in a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410643#M118508</link>
      <description>&lt;P&gt;The behavior of &lt;CODE&gt;if&lt;/CODE&gt;, &lt;CODE&gt;eval&lt;/CODE&gt;, and &lt;CODE&gt;where&lt;/CODE&gt; is to treat &lt;CODE&gt;*&lt;/CODE&gt; as a string literal.  It is only &lt;CODE&gt;search&lt;/CODE&gt; and &lt;CODE&gt;like&lt;/CODE&gt; that treat it as a wildcard.  You can switch from &lt;CODE&gt;where&lt;/CODE&gt; to &lt;CODE&gt;search&lt;/CODE&gt; and it will work.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jan 2019 17:07:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410643#M118508</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-18T17:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using Wildcard as value in a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410644#M118509</link>
      <description>&lt;P&gt;this is good to know, thanks; however, did you state that last part backwards?  search is actually what doesn't work.  where, however, works.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jan 2019 18:12:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410644#M118509</guid>
      <dc:creator>weidertc</dc:creator>
      <dc:date>2019-01-18T18:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Using Wildcard as value in a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410645#M118510</link>
      <description>&lt;P&gt;Try it yourself; test this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_* 
| search sourcetype="splunk*"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Against this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_* 
| where sourcetype="splunk*"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_* 
| where like(sourcetype, "splunk*")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You are talking about the last one, I am talking about the first 2.  Your initial search absolutely should have worked.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jan 2019 18:27:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410645#M118510</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-18T18:27:56Z</dc:date>
    </item>
    <item>
      <title>Re: Using Wildcard as value in a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410646#M118511</link>
      <description>&lt;P&gt;you're right about search and where, however, the test is not the same.  i think what i'm saying, in my example, is that if the * had to be extracted from a variable, then it will be treated as a literal, even in search.  it's almost like it's trying to do this (notice the escape char) if the value was extracted from a variable that's absent here, or token actually.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_*  | search
sourcetype="splunk\*"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;i can tell you my initial query absolutely does not work.   normally I modify what i post from the actual but in this example, it is the exact one, so no inadvertent modifications upon using it.  i created a tiny dashboard with both your query and mine.  yours works, as you claim it should, and mine doesn't.  in yours, it's extracting the * from the token and using it as a wildcard, but in mine it doesn't.  the only difference is the AppNo is coming from a lookup table instead of a log file.&lt;/P&gt;

&lt;P&gt;below is the tiny dashboard used to compare.  to test, though, you may have to change the queries slightly and create an actual lookup table with "AppNo", "FuncNo", "Functionality" with values 1, 1, whatever.  I expect to get the values of the lookup table in my query (the first one) like i get values in my log file from yours (the bottom one)&lt;/P&gt;

&lt;P&gt;Test Dash&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="dropdown" token="app" searchWhenChanged="true"&amp;gt;
  &amp;lt;label&amp;gt;Application&amp;lt;/label&amp;gt;
  &amp;lt;choice value="None"&amp;gt;None&amp;lt;/choice&amp;gt;
  &amp;lt;choice value="*"&amp;gt;All&amp;lt;/choice&amp;gt;
  &amp;lt;search&amp;gt;
    &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;/search&amp;gt;
  &amp;lt;default&amp;gt;None&amp;lt;/default&amp;gt;
  &amp;lt;initialValue&amp;gt;None&amp;lt;/initialValue&amp;gt;
&amp;lt;/input&amp;gt;


&amp;lt;panel&amp;gt;
  &amp;lt;html&amp;gt;
  &amp;lt;h4&amp;gt;app: $app$&amp;lt;/h4&amp;gt;
&amp;lt;/html&amp;gt;
&amp;lt;/panel&amp;gt;


&amp;lt;panel&amp;gt;
  &amp;lt;table&amp;gt;
    &amp;lt;search&amp;gt;
      &amp;lt;query&amp;gt;| inputlookup Functionalities.csv | search AppNo=$app$&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;/search&amp;gt;
    &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
  &amp;lt;/table&amp;gt;
&amp;lt;/panel&amp;gt;


&amp;lt;panel&amp;gt;
  &amp;lt;table&amp;gt;
    &amp;lt;search&amp;gt;
      &amp;lt;query&amp;gt;index=* earliest=-10m@m latest=-0m@m | search sourcetype=$app$&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;/search&amp;gt;
    &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
  &amp;lt;/table&amp;gt;
&amp;lt;/panel&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Jan 2019 23:23:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410646#M118511</guid>
      <dc:creator>weidertc</dc:creator>
      <dc:date>2019-01-21T23:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: Using Wildcard as value in a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410647#M118512</link>
      <description>&lt;P&gt;I am beginning to suspect that somebody may have changed a setting causing different behavior in search that we all know and love.  I have NEVER seen what you are describing before and I have seen just about everything.  Spin up a Splunk sandbox (it is free) and try it there.  Something is VERY fishy here.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2019 23:33:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410647#M118512</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-21T23:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: Using Wildcard as value in a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410648#M118513</link>
      <description>&lt;P&gt;good idea.  ill use another env.  I'll try to find some time.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jan 2019 14:31:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Wildcard-as-value-in-a-variable/m-p/410648#M118513</guid>
      <dc:creator>weidertc</dc:creator>
      <dc:date>2019-01-23T14:31:26Z</dc:date>
    </item>
  </channel>
</rss>

