<?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: Use result of eval to search in the same query in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151368#M42414</link>
    <description>&lt;P&gt;This syntax does work fine. (Try below runanywhere sample)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|gentimes start=-1 |  eval newField = lower(strftime(strptime("2014-oct" + "01","%Y-%b%d"),"regular"+"%b%y")) | table newField
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I guess the problem is with "search newField". This is like searching for string 'newField' in raw events and raw events doesn't have this field so no rows are returned. You should change this to "search newField=*" OR "where isnotnull(newField)"&lt;/P&gt;</description>
    <pubDate>Mon, 21 Jul 2014 20:11:10 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2014-07-21T20:11:10Z</dc:date>
    <item>
      <title>Use result of eval to search in the same query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151367#M42413</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Is this command not valid.&lt;/P&gt;

&lt;P&gt;&lt;SPAN&gt;&lt;CODE&gt;&lt;BR /&gt;
index=batch | eval newField = lower(strftime(strptime("2014-oct" + "01","%Y-%b%d"),"regular"+"%b%y")) | search newField&lt;BR /&gt;
&lt;/CODE&gt;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;This command never returns any values. I have checked the basics. Just wondering if eval does not work this way. Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jul 2014 19:57:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151367#M42413</guid>
      <dc:creator>splunkmasterfle</dc:creator>
      <dc:date>2014-07-21T19:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: Use result of eval to search in the same query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151368#M42414</link>
      <description>&lt;P&gt;This syntax does work fine. (Try below runanywhere sample)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|gentimes start=-1 |  eval newField = lower(strftime(strptime("2014-oct" + "01","%Y-%b%d"),"regular"+"%b%y")) | table newField
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I guess the problem is with "search newField". This is like searching for string 'newField' in raw events and raw events doesn't have this field so no rows are returned. You should change this to "search newField=*" OR "where isnotnull(newField)"&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jul 2014 20:11:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151368#M42414</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-07-21T20:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: Use result of eval to search in the same query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151369#M42415</link>
      <description>&lt;P&gt;I think maybe the OP needs a subsearch-type syntax, because it looks like they are searching for the resulting value of the &lt;CODE&gt;eval&lt;/CODE&gt; expression. So something like:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index=batch [| gentimes start=-1 | eval newField=... | table newField]&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;That should translate the subsearch expression into &lt;CODE&gt;(newField=&amp;lt;value of eval expression&amp;gt;)&lt;/CODE&gt; and apply that to &lt;CODE&gt;index=batch&lt;/CODE&gt;, which I think is what is being asked for here.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jul 2014 20:29:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151369#M42415</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2014-07-21T20:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: Use result of eval to search in the same query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151370#M42416</link>
      <description>&lt;P&gt;I manage to make this work when I have a hard coded value in the strptime function. However it does not work when I try and do the following :&lt;/P&gt;

&lt;P&gt;&lt;SPAN&gt;&lt;CODE&gt;index=batch AND [ search index=batch | eval partName=lower(strftime(strptime($cn$+"01","%Y-%b%d"),"regular"+"%b%y")) | table partName]&lt;/CODE&gt;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;$cn$ being the value sent from another dashboard. The dashboard hangs on "Waiting for Input"&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jul 2014 21:01:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151370#M42416</guid>
      <dc:creator>splunkmasterfle</dc:creator>
      <dc:date>2014-07-21T21:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: Use result of eval to search in the same query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151371#M42417</link>
      <description>&lt;P&gt;Does putting quotes around it help?&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;...(strptime("$cn$"+"01",...&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jul 2014 21:10:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151371#M42417</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2014-07-21T21:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: Use result of eval to search in the same query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151372#M42418</link>
      <description>&lt;P&gt;Doesn't seem to change anything, no &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2014 13:56:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151372#M42418</guid>
      <dc:creator>splunkmasterfle</dc:creator>
      <dc:date>2014-07-22T13:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: Use result of eval to search in the same query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151373#M42419</link>
      <description>&lt;P&gt;Did you verify if the token $cn$ is receiving values? Also, if your panels have autoRun=true or you have a Submit button? The message 'Waiting for input' does suggest that the tokens are not resolved.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2014 14:21:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151373#M42419</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-07-22T14:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: Use result of eval to search in the same query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151374#M42420</link>
      <description>&lt;P&gt;I know the token is received in my dashboard because it is visible via http GET (?form.cn=2015-Feb). I do not have a submitButton, however I do have a input dropdown that has searchWhenChanged=true. Is it maybe the fact that I use the token within a &lt;SEARCHSTRING&gt; for my chart?&lt;/SEARCHSTRING&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2014 14:52:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151374#M42420</guid>
      <dc:creator>splunkmasterfle</dc:creator>
      <dc:date>2014-07-22T14:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: Use result of eval to search in the same query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151375#M42421</link>
      <description>&lt;P&gt;Does the query works if you change the value in the input dropdown? Also, can you try by adding autoRun=True in the &lt;FIELDSET&gt;?&lt;/FIELDSET&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2014 15:08:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151375#M42421</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-07-22T15:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: Use result of eval to search in the same query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151376#M42422</link>
      <description>&lt;P&gt;So I figured it out. I didn't have the token linked to a fieldset element!&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jul 2014 13:53:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151376#M42422</guid>
      <dc:creator>splunkmasterfle</dc:creator>
      <dc:date>2014-07-23T13:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: Use result of eval to search in the same query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151377#M42423</link>
      <description>&lt;P&gt;The answer provided by aweitzman worked perfectly:&lt;/P&gt;

&lt;P&gt;&lt;SPAN&gt;&lt;CODE&gt;&lt;BR /&gt;
index=batch [| gentimes start=-1 | eval newField=... | table newField]&lt;BR /&gt;
&lt;/CODE&gt;&lt;BR /&gt;
&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;(If you want to post the answer I can mark it as solved)&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jul 2014 14:00:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151377#M42423</guid>
      <dc:creator>splunkmasterfle</dc:creator>
      <dc:date>2014-07-23T14:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Use result of eval to search in the same query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151378#M42424</link>
      <description>&lt;P&gt;Just made it an answer.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jul 2014 14:19:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-result-of-eval-to-search-in-the-same-query/m-p/151378#M42424</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2014-07-23T14:19:00Z</dc:date>
    </item>
  </channel>
</rss>

