<?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 How to get the values inside search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-values-inside-search/m-p/17194#M2385</link>
    <description>&lt;P&gt;hello, my problem is:&lt;/P&gt;

&lt;P&gt;when I type the query in the search bar, such as: &lt;/P&gt;

&lt;P&gt;source="number.txt"&lt;/P&gt;

&lt;P&gt;it will so like that:&lt;/P&gt;

&lt;P&gt;Number        UV           count
1            avc            11
2            bbb            13
3            ddd            14
.
.
.
.
.&lt;/P&gt;

&lt;P&gt;How can I get the string value inside this ? such as: only bbb   (string)&lt;/P&gt;

&lt;P&gt;because I want to use this string value bbb to do the subsearch&lt;/P&gt;

&lt;P&gt;I can  filter to only see bbb in the result but i can't use the actual truth string value &lt;/P&gt;

&lt;P&gt;to do the comparison in subsearch&lt;/P&gt;

&lt;P&gt;may be i want to do like this in sql:&lt;/P&gt;

&lt;P&gt;select *
from table 1
where uv=(select uv
          from table2)&lt;/P&gt;</description>
    <pubDate>Mon, 12 Jul 2010 15:25:18 GMT</pubDate>
    <dc:creator>sony_1688</dc:creator>
    <dc:date>2010-07-12T15:25:18Z</dc:date>
    <item>
      <title>How to get the values inside search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-values-inside-search/m-p/17194#M2385</link>
      <description>&lt;P&gt;hello, my problem is:&lt;/P&gt;

&lt;P&gt;when I type the query in the search bar, such as: &lt;/P&gt;

&lt;P&gt;source="number.txt"&lt;/P&gt;

&lt;P&gt;it will so like that:&lt;/P&gt;

&lt;P&gt;Number        UV           count
1            avc            11
2            bbb            13
3            ddd            14
.
.
.
.
.&lt;/P&gt;

&lt;P&gt;How can I get the string value inside this ? such as: only bbb   (string)&lt;/P&gt;

&lt;P&gt;because I want to use this string value bbb to do the subsearch&lt;/P&gt;

&lt;P&gt;I can  filter to only see bbb in the result but i can't use the actual truth string value &lt;/P&gt;

&lt;P&gt;to do the comparison in subsearch&lt;/P&gt;

&lt;P&gt;may be i want to do like this in sql:&lt;/P&gt;

&lt;P&gt;select *
from table 1
where uv=(select uv
          from table2)&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2010 15:25:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-values-inside-search/m-p/17194#M2385</guid>
      <dc:creator>sony_1688</dc:creator>
      <dc:date>2010-07-12T15:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the values inside search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-values-inside-search/m-p/17195#M2386</link>
      <description>&lt;P&gt;Hi sony_1688,&lt;/P&gt;

&lt;P&gt;it looks like you have some raw text data here and I hope i got your question right.&lt;/P&gt;

&lt;P&gt;What I would suggest here is to use a filed extraction for the value bbb (i.e. myField).&lt;/P&gt;

&lt;P&gt;Have a look here how to use field extraction:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://www.splunk.com/base/Documentation/4.1.3/User/ExtractNewFields" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/4.1.3/User/ExtractNewFields&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Then use a search that includes myField="bbb" in the subsearch to filter your data.&lt;/P&gt;

&lt;P&gt;Hope that helps!&lt;/P&gt;

&lt;P&gt;Cheers,&lt;/P&gt;

&lt;P&gt;Christian&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2010 15:55:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-values-inside-search/m-p/17195#M2386</guid>
      <dc:creator>simuvid</dc:creator>
      <dc:date>2010-07-12T15:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the values inside search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-values-inside-search/m-p/17196#M2387</link>
      <description>&lt;P&gt;Firstly, thank you for your help. And I can do myField="bbb" in this way. But my problem is, when I using subsearch, the problem like that&lt;/P&gt;

&lt;P&gt;myField="[sources="Number.txt" where Number="1"]"&lt;/P&gt;

&lt;P&gt;I can not do like this.Because the value that I need which is dynamic according to that subsearch&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2010 16:28:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-values-inside-search/m-p/17196#M2387</guid>
      <dc:creator>sony_1688</dc:creator>
      <dc:date>2010-07-12T16:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the values inside search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-values-inside-search/m-p/17197#M2388</link>
      <description>&lt;P&gt;Is your "bbb" value being automatically extracted as a field? If not, try to extract it as a field first before performing the search. See &lt;A href="http://www.splunk.com/base/Documentation/4.1.3/User/ExtractNewFields" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/4.1.3/User/ExtractNewFields&lt;/A&gt; for more info.&lt;/P&gt;

&lt;P&gt;Let's assume you have the field with the possible "bbb" value extracted as custom_field. Here is how you would pass this value from a subsearch to the outer search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* [search source=numbers.txt | fields + custom_field | dedup custom_field | format]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is what this search will do:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;The search inside [] will be done first&lt;/LI&gt;
&lt;LI&gt;Search only source numbers.txt (&lt;CODE&gt;source=numbers.txt&lt;/CODE&gt;)&lt;/LI&gt;
&lt;LI&gt;Retain only the custom_field field (&lt;CODE&gt;fields + custom_field&lt;/CODE&gt;)&lt;/LI&gt;
&lt;LI&gt;Remove duplicates from the custom_field field (&lt;CODE&gt;dedup custom_field&lt;/CODE&gt;)&lt;/LI&gt;
&lt;LI&gt;Pass the values of custom_field to the outer search (&lt;CODE&gt;format&lt;/CODE&gt;)&lt;/LI&gt;
&lt;LI&gt;Search everything that has the custom field values our subsearch returned (&lt;CODE&gt;*&lt;/CODE&gt;). Of course this could also be any number of search criteria.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Try running just the subsearch &lt;CODE&gt;source=numbers.txt | fields + custom_field | dedup custom_field | format&lt;/CODE&gt; by itself to see what the output of the format command is.&lt;/P&gt;

&lt;P&gt;For more info on subsearches see &lt;A href="http://www.splunk.com/base/Documentation/4.1.3/User/HowSubsearchesWork" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/4.1.3/User/HowSubsearchesWork&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;[Edit]&lt;/P&gt;

&lt;P&gt;In response to your comment, modify the search as follows to only receive the value from the subsearch, no parenthesis or anything else:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* [search source=numbers.txt | fields + custom_field | dedup custom_field | rename custom_field as search | format "" "" "" "" "" ""]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Jul 2010 20:33:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-values-inside-search/m-p/17197#M2388</guid>
      <dc:creator>ftk</dc:creator>
      <dc:date>2010-07-12T20:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the values inside search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-values-inside-search/m-p/17198#M2389</link>
      <description>&lt;P&gt;Hello... when I type source="number.txt"|where NO=1|fields + UV|dedup UV|format&lt;/P&gt;

&lt;P&gt;and then it shows the result like that:&lt;/P&gt;

&lt;P&gt;((UV="U13_V4200_02"))&lt;/P&gt;

&lt;P&gt;But when I add the [search ........]&lt;/P&gt;

&lt;P&gt;it also can not put the value to the outler search&lt;/P&gt;

&lt;P&gt;I have a question that can i get the result like that:&lt;/P&gt;

&lt;P&gt;U13_V4200_02&lt;/P&gt;

&lt;P&gt;that means only have the string and do not have ((  ))  and ""&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:15:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-values-inside-search/m-p/17198#M2389</guid>
      <dc:creator>sony_1688</dc:creator>
      <dc:date>2020-09-28T09:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the values inside search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-values-inside-search/m-p/17199#M2390</link>
      <description>&lt;P&gt;I edited my original answer to answer the question you posed in your comment..&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jul 2010 20:48:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-values-inside-search/m-p/17199#M2390</guid>
      <dc:creator>ftk</dc:creator>
      <dc:date>2010-07-13T20:48:36Z</dc:date>
    </item>
  </channel>
</rss>

