<?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 can I search for a file and then use the name of that file to drive the next search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-search-for-a-file-and-then-use-the-name-of-that-file/m-p/350797#M163224</link>
    <description>&lt;P&gt;I have a collection of hundreds of files.  I want to write a search that (1) finds which file has a certain keyword and then (2) search that particular file for additional content for tabling.&lt;/P&gt;

&lt;P&gt;Searching for the specific file is done as follows ...&lt;/P&gt;

&lt;P&gt;source="jobs/*" "load = 1234" | dedup source&lt;/P&gt;

&lt;P&gt;... but I have been googling/trying to figure out how to use that source to drive the next part of the query.  Here is some pseudocode with source renamed for ?clarity? as so far I have not been able to find a good way.&lt;/P&gt;

&lt;P&gt;source="jobs/*" "load = 1234" | dedup source | rename source as XX | search source=XX "mysearchstring"&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jan 2018 03:09:01 GMT</pubDate>
    <dc:creator>dmoulais</dc:creator>
    <dc:date>2018-01-31T03:09:01Z</dc:date>
    <item>
      <title>How can I search for a file and then use the name of that file to drive the next search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-search-for-a-file-and-then-use-the-name-of-that-file/m-p/350797#M163224</link>
      <description>&lt;P&gt;I have a collection of hundreds of files.  I want to write a search that (1) finds which file has a certain keyword and then (2) search that particular file for additional content for tabling.&lt;/P&gt;

&lt;P&gt;Searching for the specific file is done as follows ...&lt;/P&gt;

&lt;P&gt;source="jobs/*" "load = 1234" | dedup source&lt;/P&gt;

&lt;P&gt;... but I have been googling/trying to figure out how to use that source to drive the next part of the query.  Here is some pseudocode with source renamed for ?clarity? as so far I have not been able to find a good way.&lt;/P&gt;

&lt;P&gt;source="jobs/*" "load = 1234" | dedup source | rename source as XX | search source=XX "mysearchstring"&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 03:09:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-search-for-a-file-and-then-use-the-name-of-that-file/m-p/350797#M163224</guid>
      <dc:creator>dmoulais</dc:creator>
      <dc:date>2018-01-31T03:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: How can I search for a file and then use the name of that file to drive the next search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-search-for-a-file-and-then-use-the-name-of-that-file/m-p/350798#M163225</link>
      <description>&lt;P&gt;Think you want to use a subsearch:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"mysearchstring" [ search source="jobs/*" "load = 1234" | dedup source | table source ] 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.0.1/SearchTutorial/Useasubsearch"&gt;SubSearch doc&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 13:47:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-search-for-a-file-and-then-use-the-name-of-that-file/m-p/350798#M163225</guid>
      <dc:creator>teunlaan</dc:creator>
      <dc:date>2018-01-31T13:47:49Z</dc:date>
    </item>
  </channel>
</rss>

