<?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: return command works only with numeric values​​? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111700#M29272</link>
    <description>&lt;P&gt;I don't think it's possible. The closest I got was using the "map" command, which is basically a looping, "for each result  do that...". Have a look on the documentation, might be useful for you.&lt;/P&gt;</description>
    <pubDate>Tue, 09 Sep 2014 00:40:33 GMT</pubDate>
    <dc:creator>musskopf</dc:creator>
    <dc:date>2014-09-09T00:40:33Z</dc:date>
    <item>
      <title>return command works only with numeric values​​?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111689#M29261</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;
I try to return a string value and does not recognize, and when return a numeric value if recognized. No way to return the string?&lt;BR /&gt;
My Search is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    host=IMG6460B sourcetype="WinEventLog:Application" 
    | eval UserSession=[ search host=IMG6460B sourcetype="WinEventLog:System" | head 1 | return $Session]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But does not return a value, the return value is Session="a0291da-2039"&lt;/P&gt;</description>
      <pubDate>Thu, 04 Sep 2014 15:13:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111689#M29261</guid>
      <dc:creator>jrodriguezap</dc:creator>
      <dc:date>2014-09-04T15:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: return command works only with numeric values​​?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111690#M29262</link>
      <description>&lt;P&gt;With the "$" sign in front, your return value should be a0291da-2039. But i think this is not working with the eval. Not sure if this is the answer, but can you try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=IMG6460B sourcetype="WinEventLog:Application" | eval UserSession=[ search host=IMG6460B sourcetype="WinEventLog:System" | head 1 | eval temp_session="\"".Session."\"" | return $temp_session]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Sep 2014 15:38:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111690#M29262</guid>
      <dc:creator>tom_frotscher</dc:creator>
      <dc:date>2014-09-04T15:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: return command works only with numeric values​​?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111691#M29263</link>
      <description>&lt;P&gt;Thanks tom_frotscher&lt;BR /&gt;
I gave the eval, but nothing, not to return the string value, only numeric, is that normal?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Sep 2014 15:44:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111691#M29263</guid>
      <dc:creator>jrodriguezap</dc:creator>
      <dc:date>2014-09-04T15:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: return command works only with numeric values​​?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111692#M29264</link>
      <description>&lt;P&gt;That's weird: @tom_frotscher's solution totally worked for me.&lt;/P&gt;

&lt;P&gt;(As an aside - you can leave out the &lt;CODE&gt;head 1&lt;/CODE&gt; clause in the subsearch - by using the &lt;CODE&gt;return&lt;/CODE&gt; function the &lt;CODE&gt;head 1&lt;/CODE&gt; is implied.)&lt;/P&gt;

&lt;P&gt;I agree, it seems strange that you have to do the additional &lt;CODE&gt;eval&lt;/CODE&gt; processing to get it to work with string values being returned, but it does seem to work correctly.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Sep 2014 15:55:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111692#M29264</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2014-09-04T15:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: return command works only with numeric values​​?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111693#M29265</link>
      <description>&lt;P&gt;for returning multiple values use makemv and then return the whole value then divide the multivalued field.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Sep 2014 16:07:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111693#M29265</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-09-04T16:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: return command works only with numeric values​​?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111694#M29266</link>
      <description>&lt;P&gt;I tried it with another indexer, and I like it. &lt;BR /&gt;
When I run only &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search host=IMG6460B sourcetype="WinEventLog:System" | head 1 | eval temp_session="\"".Session."\"" | return $temp_session
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I returns the value &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;**temp_session**
  a0291da-2039
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but when I run it with Eval, the field UserSession does not get the value &lt;BR /&gt;
If it's weird.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Sep 2014 16:15:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111694#M29266</guid>
      <dc:creator>jrodriguezap</dc:creator>
      <dc:date>2014-09-04T16:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: return command works only with numeric values​​?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111695#M29267</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;
someone will this ever happened? or be a bug report should support?  &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Sep 2014 20:24:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111695#M29267</guid>
      <dc:creator>jrodriguezap</dc:creator>
      <dc:date>2014-09-04T20:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: return command works only with numeric values​​?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111696#M29268</link>
      <description>&lt;P&gt;Seems to be a bug, the workaround is to add the quotes as you did, it worked for me:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index=main | eval test=[ search index=other_index | head 1 | eval fieldA="\""+fieldA+"\"" | return $fieldA]&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Sep 2014 00:04:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111696#M29268</guid>
      <dc:creator>musskopf</dc:creator>
      <dc:date>2014-09-05T00:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: return command works only with numeric values​​?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111697#M29269</link>
      <description>&lt;P&gt;It is true musskopf. &lt;BR /&gt;
I had not realized that the quotes were needed. @tom_frotscher's was quite right. &lt;BR /&gt;
Sorry and thank you very much&lt;/P&gt;</description>
      <pubDate>Fri, 05 Sep 2014 04:04:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111697#M29269</guid>
      <dc:creator>jrodriguezap</dc:creator>
      <dc:date>2014-09-05T04:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: return command works only with numeric values​​?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111698#M29270</link>
      <description>&lt;P&gt;A question please. &lt;BR /&gt;
You can send a parameter from the main search to return search? &lt;BR /&gt;
I need to put a condition to return value, something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main field_MAIN=val1 | eval test=[ search index=other_index | where field_SUB=field_MAIN | head 1 | eval fieldA="\""+fieldA+"\"" | return $fieldA]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Sep 2014 05:22:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111698#M29270</guid>
      <dc:creator>jrodriguezap</dc:creator>
      <dc:date>2014-09-05T05:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: return command works only with numeric values​​?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111699#M29271</link>
      <description>&lt;P&gt;is this possible? or any other way?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Sep 2014 16:43:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111699#M29271</guid>
      <dc:creator>jrodriguezap</dc:creator>
      <dc:date>2014-09-08T16:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: return command works only with numeric values​​?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111700#M29272</link>
      <description>&lt;P&gt;I don't think it's possible. The closest I got was using the "map" command, which is basically a looping, "for each result  do that...". Have a look on the documentation, might be useful for you.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Sep 2014 00:40:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/return-command-works-only-with-numeric-values/m-p/111700#M29272</guid>
      <dc:creator>musskopf</dc:creator>
      <dc:date>2014-09-09T00:40:33Z</dc:date>
    </item>
  </channel>
</rss>

