<?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: Adding data to the table from subsearch in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Adding-data-to-the-table-from-subsearch/m-p/682728#M233234</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/266535"&gt;@abroun&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;to help you I need also the second search.&lt;/P&gt;&lt;P&gt;In few words, you have to correlate results from both the searches using stats BY common key.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Tue, 02 Apr 2024 12:16:47 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2024-04-02T12:16:47Z</dc:date>
    <item>
      <title>Adding data to the table from subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-data-to-the-table-from-subsearch/m-p/682726#M233233</link>
      <description>&lt;P&gt;Hey, I have a problem preparing a Splunjk query. Could you assist me?&lt;/P&gt;&lt;P&gt;I have a simple query that returns a table with a few fields:&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;some-search | fields id, time | table id, time&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;I also have a macro with two arguments (id and time) that returns a table with status and type fields.&lt;BR /&gt;&lt;BR /&gt;I want to modify the first query somehow to run a subquery for each row by calling my macro and appending the fields to the final table.&lt;BR /&gt;&lt;BR /&gt;Finally, I want to have a table with four fields: id, time, status, and type (where status and type were obtained by calling a subquery with id and time).&lt;BR /&gt;&lt;BR /&gt;Is it possible?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2024 12:03:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-data-to-the-table-from-subsearch/m-p/682726#M233233</guid>
      <dc:creator>abroun</dc:creator>
      <dc:date>2024-04-02T12:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: Adding data to the table from subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-data-to-the-table-from-subsearch/m-p/682728#M233234</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/266535"&gt;@abroun&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;to help you I need also the second search.&lt;/P&gt;&lt;P&gt;In few words, you have to correlate results from both the searches using stats BY common key.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2024 12:16:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-data-to-the-table-from-subsearch/m-p/682728#M233234</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-04-02T12:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: Adding data to the table from subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-data-to-the-table-from-subsearch/m-p/682731#M233236</link>
      <description>&lt;P&gt;The second search (macro) is like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;some-search-index $id$ 
| eval epoch = _time 
| where epoch &amp;lt; $timestamp$ 
| sort BY _time 
| head 1 
| fields id, status, type
| table id, status, type&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 02 Apr 2024 12:27:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-data-to-the-table-from-subsearch/m-p/682731#M233236</guid>
      <dc:creator>abroun</dc:creator>
      <dc:date>2024-04-02T12:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: Adding data to the table from subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-data-to-the-table-from-subsearch/m-p/682761#M233246</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/266535"&gt;@abroun&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;probably this is the only case where join could be the best solution:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;some-search 
| join type=left id [ search 
   some-search-index $id$ 
   | eval epoch = _time 
   | where epoch &amp;lt; $timestamp$ 
   | sort BY _time 
   | head 1 
   | fields id status type
   ]
| table id time status type&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2024 14:40:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-data-to-the-table-from-subsearch/m-p/682761#M233246</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-04-02T14:40:39Z</dc:date>
    </item>
  </channel>
</rss>

