<?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 pass event time from an inner subsearch to the outer search results table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-event-time-from-an-inner-subsearch-to-the-outer/m-p/549533#M155927</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are my searches&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;index=foo &amp;lt;search criteria&amp;gt; | table user _time&lt;BR /&gt;index=bar &amp;lt;search criteria&amp;gt; | table user _time&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The user field values are passed from inner to outer search&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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=foo [search index=bar &amp;lt;search criteria&amp;gt; | eval time1=_time | table user time1] &amp;lt;search criteria&amp;gt; |eval time2=_time| table user time1 time2&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a table &amp;gt;&amp;gt;&amp;gt;&amp;gt; user&amp;nbsp; time1 time2&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I will be doing a delta on the time diff.&lt;BR /&gt;&lt;BR /&gt;I am stuck trying to get the time carried over from the inner search to the outer search, not sure if this way is even possible...&amp;nbsp; its been a while but I am pretty sure I have done this before...&lt;/P&gt;&lt;P&gt;Seems like whenever I pass the new field time1, the outer search tries to search with that as criteria, which produces no results...&lt;/P&gt;&lt;P&gt;Thx!&lt;/P&gt;</description>
    <pubDate>Tue, 27 Apr 2021 21:53:35 GMT</pubDate>
    <dc:creator>Glasses</dc:creator>
    <dc:date>2021-04-27T21:53:35Z</dc:date>
    <item>
      <title>How to pass event time from an inner subsearch to the outer search results table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-event-time-from-an-inner-subsearch-to-the-outer/m-p/549533#M155927</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are my searches&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;index=foo &amp;lt;search criteria&amp;gt; | table user _time&lt;BR /&gt;index=bar &amp;lt;search criteria&amp;gt; | table user _time&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The user field values are passed from inner to outer search&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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=foo [search index=bar &amp;lt;search criteria&amp;gt; | eval time1=_time | table user time1] &amp;lt;search criteria&amp;gt; |eval time2=_time| table user time1 time2&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a table &amp;gt;&amp;gt;&amp;gt;&amp;gt; user&amp;nbsp; time1 time2&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I will be doing a delta on the time diff.&lt;BR /&gt;&lt;BR /&gt;I am stuck trying to get the time carried over from the inner search to the outer search, not sure if this way is even possible...&amp;nbsp; its been a while but I am pretty sure I have done this before...&lt;/P&gt;&lt;P&gt;Seems like whenever I pass the new field time1, the outer search tries to search with that as criteria, which produces no results...&lt;/P&gt;&lt;P&gt;Thx!&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 21:53:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-event-time-from-an-inner-subsearch-to-the-outer/m-p/549533#M155927</guid>
      <dc:creator>Glasses</dc:creator>
      <dc:date>2021-04-27T21:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass event time from an inner subsearch to the outer search results table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-event-time-from-an-inner-subsearch-to-the-outer/m-p/549539#M155930</link>
      <description>&lt;P&gt;Run the subsearch by itself with the format command appended to see what it is passing to the main search.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=bar &amp;lt;search criteria&amp;gt; 
| eval time1=_time 
| table user time1 
| format&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You should get results that look a bit like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;((user=foo time1=bar) OR (user=foo2 time1=bar2) OR (user=foo3 time1=bar3))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When that is added to the main search it looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=foo ((user=foo time1=bar) OR (user=foo2 time1=bar2) OR (user=foo3 time1=bar3)) &amp;lt;search criteria&amp;gt; 
| eval time2=_time
| table user time1 time2&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It should work well if the index in the main search has a field called "time"1", but otherwise you'll end up with nothing.&lt;/P&gt;&lt;P&gt;Use a subsearch when you need the results of a search to become part of the enclosing search.&amp;nbsp; If you just need to combine the results of two searches then there are easier ways.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=foo &amp;lt;search criteria&amp;gt; 
| fields user _time
| eval time1=_time
| append [ search index=bar &amp;lt;search criteria&amp;gt; 
  | fields user _time
  | eval time2=_time
]
| stats values(*) as * by user
| table user time1 time2&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 23:39:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-event-time-from-an-inner-subsearch-to-the-outer/m-p/549539#M155930</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-04-27T23:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass event time from an inner subsearch to the outer search results table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-event-time-from-an-inner-subsearch-to-the-outer/m-p/549541#M155932</link>
      <description>&lt;P&gt;Thanks Rich your suggestion helps get me closer, only issue is the table does not list exactly the way I want, but I think I can solve that, if not I will ask another question.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 23:12:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-event-time-from-an-inner-subsearch-to-the-outer/m-p/549541#M155932</guid>
      <dc:creator>Glasses</dc:creator>
      <dc:date>2021-04-27T23:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass event time from an inner subsearch to the outer search results table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-event-time-from-an-inner-subsearch-to-the-outer/m-p/549544#M155935</link>
      <description>&lt;P&gt;I think I know why the table doesn't look right.&amp;nbsp; Try my revised answer.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 23:39:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-event-time-from-an-inner-subsearch-to-the-outer/m-p/549544#M155935</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-04-27T23:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass event time from an inner subsearch to the outer search results table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-event-time-from-an-inner-subsearch-to-the-outer/m-p/549643#M155976</link>
      <description>&lt;P&gt;Hi Rich,&amp;nbsp;&lt;/P&gt;&lt;P&gt;The table format I want is&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;user           time2         time1       match   diff

alice        1619615378	   1619615378	  yes     0

bob          1619534249    1619534249     yes     0

charlie      1619541847    1619541846     no      1&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;I know that is more than this thread covers but here is where I am stuck&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;index=foo &amp;lt;search criteria&amp;gt; 
| fields user _time
| eval time1=_time
| append [ search index=bar &amp;lt;search criteria&amp;gt; 
  | fields user _time
  | eval time2=_time ]
| chart values(time2) as time2 values(time1) as time1 over user&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;currently trying to get the "match" to work and find the "difference" between (time2-time1) but with chart "values" I have multiple lines per user, still trying to wrangle this....&lt;/P&gt;&lt;P&gt;for example, this is a result&amp;nbsp;&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;alice       1619534249   1619534249      
            1619614029   1619614029	      
            1619614364   1619614363       &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2021 14:48:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-event-time-from-an-inner-subsearch-to-the-outer/m-p/549643#M155976</guid>
      <dc:creator>Glasses</dc:creator>
      <dc:date>2021-04-28T14:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass event time from an inner subsearch to the outer search results table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-event-time-from-an-inner-subsearch-to-the-outer/m-p/549843#M156046</link>
      <description>&lt;P&gt;Perhaps this will help get the remaining fields.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=foo &amp;lt;search criteria&amp;gt; 
| fields user _time
| eval time1=_time
| append [ search index=bar &amp;lt;search criteria&amp;gt; 
  | fields user _time
  | eval time2=_time
]
| stats values(*) as * by user
| eval match=if(time1=time2, "yes", "no"), diff=time2-time1)
| table user time1 time2 match diff&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 29 Apr 2021 13:52:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-event-time-from-an-inner-subsearch-to-the-outer/m-p/549843#M156046</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-04-29T13:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass event time from an inner subsearch to the outer search results table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-event-time-from-an-inner-subsearch-to-the-outer/m-p/549850#M156050</link>
      <description>&lt;P&gt;Thank you Rich.&amp;nbsp; I apologize the query requestors changed directions on what they need but yes, you replies have helped, especially explaining the " | append [subsearch] "...&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 14:22:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-event-time-from-an-inner-subsearch-to-the-outer/m-p/549850#M156050</guid>
      <dc:creator>Glasses</dc:creator>
      <dc:date>2021-04-29T14:22:12Z</dc:date>
    </item>
  </channel>
</rss>

