<?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: Subsearch time range in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Subsearch-time-range/m-p/418215#M27538</link>
    <description>&lt;P&gt;@szrobag you can add &lt;CODE&gt;earliest&lt;/CODE&gt; and &lt;CODE&gt;latest&lt;/CODE&gt; time to both your main search and sub-search as per your use case. The following query finds src_ip for last 15 min and then renames and correlates with subsearch running for last 1 hour.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=fw src_translated_ip="$subsearch_src_ip$" earliest=-15m@m latest=now 
| dedup src_ip 
| rename src_ip as dest_ip
| join type=left max=1 dest_ip [ search index=dhcp earliest=-1h@h latest=now sourcetype=isc:dhcp dhcp_type=DHCPACK ]
| table dest_ip dest_mac
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 23 Aug 2018 19:42:12 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2018-08-23T19:42:12Z</dc:date>
    <item>
      <title>Subsearch time range</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Subsearch-time-range/m-p/418212#M27535</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I'd like to run a subsearch  with different time range than the parent search. Have to get mac addresses, and need a bigger time range to see results in DHCP logs. you help what's wrong with this ?&lt;/P&gt;

&lt;P&gt;index=fw src_translated_ip="$subsearch_src_ip$" &lt;BR /&gt;
| dedup src_ip &lt;BR /&gt;
| rename src_ip as dest_ip&lt;BR /&gt;
| join type=left max=1 dest_ip [ search index=dhcp earliest=-1h@h sourcetype=isc:dhcp dhcp_type=DHCPACK ]&lt;BR /&gt;
| table dest_ip dest_mac&lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:58:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Subsearch-time-range/m-p/418212#M27535</guid>
      <dc:creator>szrobag</dc:creator>
      <dc:date>2020-09-29T20:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch time range</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Subsearch-time-range/m-p/418213#M27536</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;You would like to see the results for how many Mac_Addresses that has logged in the last one hour also logged previously in a bigger range of time.&lt;/P&gt;

&lt;P&gt;I think you just need to return dest_ips from your subsearch as src_ip(Since we are joinning. their field names must match) and search it in your main query. Following query should work for you.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;index=fw&lt;BR /&gt;&lt;BR /&gt;
| dedup src_ip &lt;BR /&gt;
| join type=left max=1 src_ip &lt;BR /&gt;
                    [ search index=dhcp  sourcetype=isc:dhcp dhcp_type=DHCPACK earliest=-1h@h&lt;BR /&gt;
                    |stats count by dest_ip ]       //This will return distinct destination ips in the last hour.&lt;BR /&gt;
| rename src_ip as dest_ip&lt;BR /&gt;
| table dest_ip dest_mac&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:58:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Subsearch-time-range/m-p/418213#M27536</guid>
      <dc:creator>halisc</dc:creator>
      <dc:date>2020-09-29T20:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch time range</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Subsearch-time-range/m-p/418214#M27537</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
Thank you for your reply. I think the structure of my query is okay, but i have only few results because of the subsearch time range.Let me tell you about the details about what i need. The main query looks for IP addresses which had traffic in the selected time range. The time period is pretty short, usually 1-2 mins. Theese addresses are the src_ip's. In the subsearch i am looking for the MAC addresses of the src_ip addresses, not the number of MAC or IP values. I need to use a dhcp log to pair the values filtered DHCPACK type, and that 1-2 min time period is very short to find DHCPACK in the log. The quest would be to run the subsearch 1 or 2 hour time range before the main query. I would try your one tomorrow, hope you had a good idea.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:59:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Subsearch-time-range/m-p/418214#M27537</guid>
      <dc:creator>szrobag</dc:creator>
      <dc:date>2020-09-29T20:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch time range</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Subsearch-time-range/m-p/418215#M27538</link>
      <description>&lt;P&gt;@szrobag you can add &lt;CODE&gt;earliest&lt;/CODE&gt; and &lt;CODE&gt;latest&lt;/CODE&gt; time to both your main search and sub-search as per your use case. The following query finds src_ip for last 15 min and then renames and correlates with subsearch running for last 1 hour.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=fw src_translated_ip="$subsearch_src_ip$" earliest=-15m@m latest=now 
| dedup src_ip 
| rename src_ip as dest_ip
| join type=left max=1 dest_ip [ search index=dhcp earliest=-1h@h latest=now sourcetype=isc:dhcp dhcp_type=DHCPACK ]
| table dest_ip dest_mac
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Aug 2018 19:42:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Subsearch-time-range/m-p/418215#M27538</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-08-23T19:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch time range</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Subsearch-time-range/m-p/418216#M27539</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Thanks, but i use an dashboard, and would like to use time picker and tokens. If the date token is subsearch_time, can i use it as earliest= $subsearch_time.earliest$ -3600 and latest=$subsearch_time.latest$ ?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:59:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Subsearch-time-range/m-p/418216#M27539</guid>
      <dc:creator>szrobag</dc:creator>
      <dc:date>2020-09-29T20:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch time range</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Subsearch-time-range/m-p/418217#M27540</link>
      <description>&lt;P&gt;Hi. Do you find any solution to this? I have this problem too. Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2019 08:00:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Subsearch-time-range/m-p/418217#M27540</guid>
      <dc:creator>iancorrea</dc:creator>
      <dc:date>2019-06-18T08:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch time range</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Subsearch-time-range/m-p/418218#M27541</link>
      <description>&lt;P&gt;Hello @szrobag,&lt;/P&gt;

&lt;P&gt;Your query is absolutely correct if what you want is to give time-range token to outer search and some fix time-range to sub-search.&lt;BR /&gt;
Let me know if you want to have something else with this or there is some relation between outer queries timerange and sub-search time-range.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2019 11:36:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Subsearch-time-range/m-p/418218#M27541</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2019-06-18T11:36:52Z</dc:date>
    </item>
  </channel>
</rss>

