<?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: How to get tstats results independent of time range in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-tstats-results-independent-of-time-range/m-p/472381#M132908</link>
    <description>&lt;P&gt;If I set the time range to ALL, query takes forever to execute.&lt;BR /&gt;
Is there any other efficient way to do it? I just need the list&lt;/P&gt;</description>
    <pubDate>Thu, 05 Sep 2019 12:07:28 GMT</pubDate>
    <dc:creator>gaurav_maniar</dc:creator>
    <dc:date>2019-09-05T12:07:28Z</dc:date>
    <item>
      <title>How to get tstats results independent of time range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-tstats-results-independent-of-time-range/m-p/472378#M132905</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;is it possible to get list of sourcetype by host and index irrespective of time range?&lt;BR /&gt;
I just want the list of index, host and sourcetype for which events are available, even if there is only one event in last 6 months for any sourcetype/host/index.&lt;/P&gt;

&lt;P&gt;The environment is very huge with 130K+ host sending data, the below query only returns the list if any event is there in selected time range,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats values(sourcetype) as sourcetype where index=* by index host | outputlookup host_list.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If there any other faster/efficient way to get the results?&lt;BR /&gt;
Let me know if any other details are required.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 21:50:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-tstats-results-independent-of-time-range/m-p/472378#M132905</guid>
      <dc:creator>gaurav_maniar</dc:creator>
      <dc:date>2019-09-04T21:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to get tstats results independent of time range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-tstats-results-independent-of-time-range/m-p/472379#M132906</link>
      <description>&lt;P&gt;Greetings @gaurav_maniar,&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;tstats&lt;/CODE&gt; is an extremely efficient command. I can not think of any quicker way to do it. I was able to run the query below in 20 seconds in our environment (note that it is running for all time):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats values(sourcetype) as sourcetype where index=* earliest=0 by index host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Sep 2019 21:58:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-tstats-results-independent-of-time-range/m-p/472379#M132906</guid>
      <dc:creator>jacobpevans</dc:creator>
      <dc:date>2019-09-04T21:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to get tstats results independent of time range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-tstats-results-independent-of-time-range/m-p/472380#M132907</link>
      <description>&lt;PRE&gt;&lt;CODE&gt; | tstats count where index=* earliest=0 by index host sourcetype 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;gives you a more tabular result without the multivalue field.  It is sometimes easier to manipulate depending on what you are trying to do with the data.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 22:39:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-tstats-results-independent-of-time-range/m-p/472380#M132907</guid>
      <dc:creator>hunderliggur</dc:creator>
      <dc:date>2019-09-04T22:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to get tstats results independent of time range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-tstats-results-independent-of-time-range/m-p/472381#M132908</link>
      <description>&lt;P&gt;If I set the time range to ALL, query takes forever to execute.&lt;BR /&gt;
Is there any other efficient way to do it? I just need the list&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 12:07:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-tstats-results-independent-of-time-range/m-p/472381#M132908</guid>
      <dc:creator>gaurav_maniar</dc:creator>
      <dc:date>2019-09-05T12:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to get tstats results independent of time range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-tstats-results-independent-of-time-range/m-p/472382#M132909</link>
      <description>&lt;P&gt;What is "forever"? The only way to further optimize it is by time. Do you really care about one year ago? Six months ago? One month ago?&lt;/P&gt;

&lt;P&gt;If you need this data, this is the way to do it (I do prefer @hunderliggur's query to the OP query, but it should not give any noticeable performance benefit).&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 14:09:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-tstats-results-independent-of-time-range/m-p/472382#M132909</guid>
      <dc:creator>jacobpevans</dc:creator>
      <dc:date>2019-09-05T14:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to get tstats results independent of time range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-tstats-results-independent-of-time-range/m-p/472383#M132910</link>
      <description>&lt;P&gt;Not sure if this would be faster than tstats. Give this a try.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest servicesNS/-/-/data/indexes 
| where totalEventCount&amp;gt;0 
| table title 
| map 
    [| metadata index=$title$ type=hosts 
    | eval index="$title$"] 
| stats values(host) as hosts by index delim="," 
| map 
    [| metadata index=$index$ type=sourcetypes 
    | eval index="$index$", hosts="$hosts$"] 
| stats values(hosts) as hosts, values(sourcetype) as sourcetypes by index 
| eval hosts=split(hosts,",")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Run the search for "All Time"&lt;BR /&gt;
 Considering that this is using the metadata tag, it should theoretically work faster.&lt;/P&gt;

&lt;P&gt;Hope this helps.&lt;/P&gt;

&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 12:29:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-tstats-results-independent-of-time-range/m-p/472383#M132910</guid>
      <dc:creator>arjunpkishore5</dc:creator>
      <dc:date>2019-11-04T12:29:04Z</dc:date>
    </item>
  </channel>
</rss>

