<?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: first query table output as input to another query in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/first-query-table-output-as-input-to-another-query/m-p/569962#M198665</link>
    <description>&lt;P&gt;From your description it looks like your k8s_label is a field containing 4 lines of data, each line represents a field of its own. However, your where statement in your first query references 'id=&amp;lt;xxx&amp;gt;" where there is no id= component in that text.&lt;/P&gt;&lt;P&gt;What do you want as your final output?&lt;/P&gt;&lt;P&gt;However, in terms of using one query to filter another you can use a subsearch, e.g.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=&amp;lt;index_name&amp;gt;  "server failed" [
    search index=&amp;lt;index_name&amp;gt;  sourcetype=&amp;lt;sourcetype_name&amp;gt; 
    | rex field=k8s_label "(?s)project_id=(?&amp;lt;Project_id&amp;gt;\d+)"
    | fields Project_id
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;which will use the Project_id from the subsearch as a filter to the outer search for server failed, but I am not clear if this is what you need. Can you clarify your data and expected output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 06 Oct 2021 21:36:18 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2021-10-06T21:36:18Z</dc:date>
    <item>
      <title>first query table output as input to another query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/first-query-table-output-as-input-to-another-query/m-p/569957#M198661</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can i please know how to parse the value to the 2nd query from the output of 1st query. Any help would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1st query:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;index=&amp;lt;index_name&amp;gt;&amp;nbsp; sourcetype=&amp;lt;sourcetype_name&amp;gt; | table k8s_label | where k8s_label="id=&amp;lt;id_number&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1st Query Output:&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV class="multivalue-subcell"&gt;name=peter&lt;/DIV&gt;&lt;DIV class="multivalue-subcell"&gt;&lt;U&gt;&lt;EM&gt;project_id=123&lt;/EM&gt;&lt;/U&gt;&lt;/DIV&gt;&lt;DIV class="multivalue-subcell"&gt;user_id=2700835661&lt;/DIV&gt;&lt;DIV class="multivalue-subcell"&gt;zone=us-west-2a&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2nd Query&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;index=&amp;lt;index_name&amp;gt;&amp;nbsp; "server failed" &lt;EM&gt;Project_id=&amp;lt;need to get project_id&amp;nbsp; from the result of 1st query Output&amp;gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 20:57:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/first-query-table-output-as-input-to-another-query/m-p/569957#M198661</guid>
      <dc:creator>vadlamudi</dc:creator>
      <dc:date>2021-10-06T20:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: first query table output as input to another query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/first-query-table-output-as-input-to-another-query/m-p/569962#M198665</link>
      <description>&lt;P&gt;From your description it looks like your k8s_label is a field containing 4 lines of data, each line represents a field of its own. However, your where statement in your first query references 'id=&amp;lt;xxx&amp;gt;" where there is no id= component in that text.&lt;/P&gt;&lt;P&gt;What do you want as your final output?&lt;/P&gt;&lt;P&gt;However, in terms of using one query to filter another you can use a subsearch, e.g.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=&amp;lt;index_name&amp;gt;  "server failed" [
    search index=&amp;lt;index_name&amp;gt;  sourcetype=&amp;lt;sourcetype_name&amp;gt; 
    | rex field=k8s_label "(?s)project_id=(?&amp;lt;Project_id&amp;gt;\d+)"
    | fields Project_id
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;which will use the Project_id from the subsearch as a filter to the outer search for server failed, but I am not clear if this is what you need. Can you clarify your data and expected output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 21:36:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/first-query-table-output-as-input-to-another-query/m-p/569962#M198665</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-10-06T21:36:18Z</dc:date>
    </item>
  </channel>
</rss>

