<?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: How to use subsearch without a field name? (but just with field value for more than one fileld) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646054#M223657</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/212163"&gt;@thanchen&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;it's not clear for me where you take val1 and val2, anyway, you can use the subsearch two times:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_main_search&amp;gt; ([ search &amp;lt;your_secondary_search&amp;gt; | rename field1 AS query | fields query ] OR [ search &amp;lt;your_secondary_search&amp;gt; | rename field2 AS query | fields query ])
...&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Wed, 07 Jun 2023 09:00:25 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2023-06-07T09:00:25Z</dc:date>
    <item>
      <title>How to use subsearch without a field name? (but just with field value for more than one fileld)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646040#M223650</link>
      <description>&lt;P&gt;Here is the document, but how?&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.6/Search/Changetheformatofsubsearchresults" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.6/Search/Changetheformatofsubsearchresults&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Using the query field name
Use the query field name when you want the values in the fields returned from the subsearch, but not the field names.

The query field name is similarly to using the format command. Instead of passing the field and value pairs to the main search, such as:

(field1=val1_1 AND field2=val1_2) OR (field1=val2_1 AND field2=val2_2)  

Using the query field name passes only the values:

(val1_1 AND val1_2) OR (val2_1 AND val2_2) &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;When rename one fields as query, got `remoteSearch premakeresults 1 ( ( field2="val1_2" AND val1_1 ) )` in inspect job log's remoteSearch.&lt;BR /&gt;What I want is&amp;nbsp;`remoteSearch premakeresults 1 ( ( "val1_2" AND val1_1 ) )`&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 1 

[ 
    | makeresults 1 
    | eval field1="val1_1" 
    | eval field2="val1_2" 
    | fields field1 field2
    | rename field1 AS query
    ```| rename field2 AS query```
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Below post only rename one field as query.&lt;BR /&gt;&lt;A href="https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/449282" target="_blank" rel="noopener"&gt;https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/449282&lt;/A&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/1406"&gt;@woodcock&lt;/a&gt;&amp;nbsp;sorry to bother you, seeing a lot of high quality answers from you, seeking your help here.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 08:03:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646040#M223650</guid>
      <dc:creator>thanchen</dc:creator>
      <dc:date>2023-06-07T08:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to use subsearch without a field name? (but just with field value for more than one fileld)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646041#M223651</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/212163"&gt;@thanchen&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;you can pass a value from a subsearch without specifying the field name renaming the field as "query", in this way you perform a full text search on the main search events, some thing like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_main_search&amp;gt; [ search &amp;lt;your_secondary_search&amp;gt; | rename field1 AS query | fields query ]
...&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 08:12:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646041#M223651</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-06-07T08:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use subsearch without a field name? (but just with field value for more than one fileld)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646049#M223653</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;there are couple of ways to test it, but probably easiest way to test it is&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_audit 
    [| makeresults 
    | eval query="val1_1 AND val1_1" 
    | table query]&lt;/LI-CODE&gt;&lt;P&gt;Another way is use search instead of query as field name.&lt;/P&gt;&lt;P&gt;Here is one recent post how to do this &lt;A href="https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-format-to-get/m-p/645818/highlight/true#M223599" target="_blank"&gt;https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-format-to-get/m-p/645818/highlight/true#M223599&lt;/A&gt;&lt;/P&gt;&lt;P&gt;r. Ismo&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 08:41:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646049#M223653</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2023-06-07T08:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to use subsearch without a field name? (but just with field value for more than one fileld)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646051#M223655</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Giuseppe, I tried this, it only gives me `premakeresults 1 ( ( val1_1 ) )`&lt;BR /&gt;I need `premakeresults 1 ( ( val1_1 AND&amp;nbsp;val1_2 ) )`&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 08:50:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646051#M223655</guid>
      <dc:creator>thanchen</dc:creator>
      <dc:date>2023-06-07T08:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to use subsearch without a field name? (but just with field value for more than one fileld)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646054#M223657</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/212163"&gt;@thanchen&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;it's not clear for me where you take val1 and val2, anyway, you can use the subsearch two times:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_main_search&amp;gt; ([ search &amp;lt;your_secondary_search&amp;gt; | rename field1 AS query | fields query ] OR [ search &amp;lt;your_secondary_search&amp;gt; | rename field2 AS query | fields query ])
...&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 09:00:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646054#M223657</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-06-07T09:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to use subsearch without a field name? (but just with field value for more than one fileld)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646063#M223658</link>
      <description>&lt;P&gt;My example in only a&amp;nbsp;Minimal, Reproducible Example&lt;BR /&gt;val1 and val2 comes from two fields field1 and field2&lt;BR /&gt;Use the subsearch two times should be a workaround, but if I want three or more, I believe there should be a solution.&lt;BR /&gt;&lt;BR /&gt;And I tried `| rex mode=sed field=search "s/(field1|field2)=//g"` at the end of subsearch, no luck.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 09:20:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646063#M223658</guid>
      <dc:creator>thanchen</dc:creator>
      <dc:date>2023-06-07T09:20:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to use subsearch without a field name? (but just with field value for more than one fileld)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646064#M223659</link>
      <description>&lt;P&gt;Have you try something like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_main_search&amp;gt; 
  [ search &amp;lt;your_secondary_search&amp;gt;
    | eval search=field1 . " AND " . field2
    | table search ] &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 09:25:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646064#M223659</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2023-06-07T09:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to use subsearch without a field name? (but just with field value for more than one fileld)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646073#M223660</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt;&amp;nbsp;, this one works, but only work for one row output in subsearch&lt;BR /&gt;&lt;BR /&gt;but in real world, we may need more than one row results in subseach, just like the official document shows:&lt;/P&gt;&lt;PRE&gt;(val1_1 AND val1_2) OR (val2_1 AND val2_2) &lt;/PRE&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.6/Search/Changetheformatofsubsearchresults" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.6/Search/Changetheformatofsubsearchresults&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;cc:&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 09:42:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646073#M223660</guid>
      <dc:creator>thanchen</dc:creator>
      <dc:date>2023-06-07T09:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to use subsearch without a field name? (but just with field value for more than one fileld)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646079#M223661</link>
      <description>&lt;P&gt;Looks by doing below, it could cover the case that have multi rows results in subsearch.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_main_search&amp;gt; 
  [ search &amp;lt;your_secondary_search&amp;gt;
| eval search="(\"" + field1 + "\" AND \"" + field2 + "\")" 

| stats
    values(search) AS searches 
| eval search=mvjoin(searches, " OR ")

| fields search
]&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 07 Jun 2023 10:11:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646079#M223661</guid>
      <dc:creator>thanchen</dc:creator>
      <dc:date>2023-06-07T10:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to use subsearch without a field name? (but just with field value for more than one fileld)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646081#M223663</link>
      <description>&lt;P&gt;The answer is already in the link, sorry I didn't read it carefully at the begining, the discusstion with&amp;nbsp;&lt;SPAN&gt;Giuseppe lead to the same solution.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&amp;lt;your_main_search&amp;gt; 
  [ search &amp;lt;your_secondary_search&amp;gt;
| eval search="(\"" + field1 + "\" AND \"" + field2 + "\")" 

| stats
    values(search) AS searches 
| eval search=mvjoin(searches, " OR ")

| fields search
]&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 10:27:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646081#M223663</guid>
      <dc:creator>thanchen</dc:creator>
      <dc:date>2023-06-07T10:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to use subsearch without a field name? (but just with field value for more than one fileld)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646082#M223664</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/212163"&gt;@thanchen&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the contributors &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 10:32:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearch-without-a-field-name-but-just-with-field/m-p/646082#M223664</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-06-07T10:32:20Z</dc:date>
    </item>
  </channel>
</rss>

