<?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 can i list all indexes and sourcetypes?! in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68499#M17180</link>
    <description>&lt;P&gt;The discrepancy is due to the fact that tstats takes selected time period into consideration. So unless you select ALL TIME, you won't be seeing all indexes and sourcetypes.&lt;/P&gt;</description>
    <pubDate>Thu, 31 Aug 2017 11:28:35 GMT</pubDate>
    <dc:creator>jagadeeshm</dc:creator>
    <dc:date>2017-08-31T11:28:35Z</dc:date>
    <item>
      <title>how can i list all indexes and sourcetypes?!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68486#M17167</link>
      <description>&lt;P&gt;i can do &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metadata type=sourcetypes |table sourcetype
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but what i would like is the equivalent of:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metadata type=sourcetypes index=* | table index sourcetype
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;however this does not work and does not enter data in the index column&lt;/P&gt;

&lt;P&gt;How can i achieve this very simple list, preferably without using stats command&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2012 11:36:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68486#M17167</guid>
      <dc:creator>r999</dc:creator>
      <dc:date>2012-12-19T11:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: how can i list all indexes and sourcetypes?!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68487#M17168</link>
      <description>&lt;P&gt;You can get a list of indexes like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eventcount summarize=f index=* index=_* | dedup index | fields index
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See &lt;A href="http://splunk-base.splunk.com/answers/39370/is-it-possibl-to-get-a-list-of-available-indices"&gt;http://splunk-base.splunk.com/answers/39370/is-it-possibl-to-get-a-list-of-available-indices&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Your search doesn't work because metadata does not contain any field "index". It does give you the list of sourcetypes though.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2012 12:12:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68487#M17168</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2012-12-19T12:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: how can i list all indexes and sourcetypes?!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68488#M17169</link>
      <description>&lt;P&gt;I think these solutions are overkill, and perhaps less efficient. Let's use tstats and go home early.. (its not the stats command.. &lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt; )&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats values(sourcetype) where index=* group by index
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 25 Dec 2015 05:22:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68488#M17169</guid>
      <dc:creator>esix_splunk</dc:creator>
      <dc:date>2015-12-25T05:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: how can i list all indexes and sourcetypes?!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68489#M17170</link>
      <description>&lt;P&gt;I generally would prefer to use tstats (and am trying to get better with it!), but your string does not return all indexes and sourcetypes active in my environment. When I use this tstats search:&lt;/P&gt;

&lt;P&gt;| tstats values(sourcetype) as sourcetype where index=* OR index=_* group by index&lt;/P&gt;

&lt;P&gt;I get 19 indexes and 50 sourcetypes. &lt;/P&gt;

&lt;P&gt;When i use the accepted answer (eventcount) i get 30 indexes and 295 sourcetypes.&lt;/P&gt;

&lt;P&gt;I tried excluding index=_* from both searches and still saw a huge difference in the results. Any thoughts on why there is a discrepancy?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2016 23:15:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68489#M17170</guid>
      <dc:creator>tmerry</dc:creator>
      <dc:date>2016-01-12T23:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: how can i list all indexes and sourcetypes?!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68490#M17171</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Make sure you use that and not just index=, especially if you have search filters setup so that not all indexes are searched by default.&lt;/P&gt;

&lt;P&gt;Regarding excluding index=_*, these are internal indexes for Splunk. Of course if you are skipping these and expecting them to be in the event count, then your numbers will be off. &lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2016 01:06:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68490#M17171</guid>
      <dc:creator>esix_splunk</dc:creator>
      <dc:date>2016-01-13T01:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: how can i list all indexes and sourcetypes?!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68491#M17172</link>
      <description>&lt;P&gt;Sorry, the asterisks were stripped out of my comment, but they were there when I did my comparison.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats values(sourcetype) as sourcetype where index=* OR index=_* group by index
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I added the internal indexes to your proposed tstats search to match the search string in the accepted answer above. If I remove them from both searches, I still see a major discrepancy in results.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2016 21:09:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68491#M17172</guid>
      <dc:creator>tmerry</dc:creator>
      <dc:date>2016-01-14T21:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: how can i list all indexes and sourcetypes?!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68492#M17173</link>
      <description>&lt;P&gt;When I have tried using the above tstats I don't get all of my indexes/sourcetypes. When I use | eventcount summarize=false index=* index=_* | dedup index | fields index  | map maxsearches=100 search=" | metadata type=sourcetypes index=\"$index$\" | eval index=\"$index$\"" | stats values(sourcetype) by index&lt;/P&gt;

&lt;P&gt;I get a list of all of them&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2016 22:48:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68492#M17173</guid>
      <dc:creator>Dallastek</dc:creator>
      <dc:date>2016-01-14T22:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: how can i list all indexes and sourcetypes?!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68493#M17174</link>
      <description>&lt;P&gt;This was a perfect answer exactly what I needed, and very fast.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 14:58:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68493#M17174</guid>
      <dc:creator>mrjoshua050</dc:creator>
      <dc:date>2016-07-21T14:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: how can i list all indexes and sourcetypes?!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68494#M17175</link>
      <description>&lt;P&gt;I downvoted this post because need to run this over all time for this to be accurate and is then significantly slower over larger data sets.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 21:06:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68494#M17175</guid>
      <dc:creator>furby559</dc:creator>
      <dc:date>2016-07-21T21:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: how can i list all indexes and sourcetypes?!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68495#M17176</link>
      <description>&lt;P&gt;so what did you end-up doing?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2017 01:45:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68495#M17176</guid>
      <dc:creator>jagadeeshm</dc:creator>
      <dc:date>2017-01-26T01:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: how can i list all indexes and sourcetypes?!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68496#M17177</link>
      <description>&lt;P&gt;We used tstats and we only run it on part of the data. We really wanted a list of which hosts send what sourcetype and source to what index. We run it on a small sampling of the data and collect it weekly and add it to our own lookup/csv to keep track.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2017 15:55:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68496#M17177</guid>
      <dc:creator>SarahBOA</dc:creator>
      <dc:date>2017-01-26T15:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: how can i list all indexes and sourcetypes?!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68497#M17178</link>
      <description>&lt;P&gt;Does this involve any setup ? the docs indicate that you need to run tscollect to create the tsidx files that tstats uses. If my answer is out-dated, i'll remove it.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 18:05:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68497#M17178</guid>
      <dc:creator>jonuwz</dc:creator>
      <dc:date>2017-02-20T18:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: how can i list all indexes and sourcetypes?!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68498#M17179</link>
      <description>&lt;P&gt;Our &lt;CODE&gt;eventcount&lt;/CODE&gt; answers still are valid, though &lt;CODE&gt;tstats&lt;/CODE&gt; can answer the same questions nowadays - no setup needed for indexed fields like sourcetype and index.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 18:18:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68498#M17179</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2017-02-20T18:18:17Z</dc:date>
    </item>
    <item>
      <title>Re: how can i list all indexes and sourcetypes?!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68499#M17180</link>
      <description>&lt;P&gt;The discrepancy is due to the fact that tstats takes selected time period into consideration. So unless you select ALL TIME, you won't be seeing all indexes and sourcetypes.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 11:28:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68499#M17180</guid>
      <dc:creator>jagadeeshm</dc:creator>
      <dc:date>2017-08-31T11:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: how can i list all indexes and sourcetypes?!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68500#M17181</link>
      <description>&lt;P&gt;| tstats count WHERE index=* by index sourcetype | stats values(sourcetype) by index,| tstats count WHERE index=* by index sourcetype | stats values(sourcetype) by index&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 18:35:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68500#M17181</guid>
      <dc:creator>moh30ka</dc:creator>
      <dc:date>2019-04-16T18:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: how can i list all indexes and sourcetypes?!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68501#M17182</link>
      <description>&lt;P&gt;For some reason, I get fewer results with tstats recommendation than I get with the first recommendation.  I have one index that has 3 sourcetypes and with tstats, it only shows one of them.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 17:19:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68501#M17182</guid>
      <dc:creator>sjbriggs</dc:creator>
      <dc:date>2019-10-10T17:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: how can i list all indexes and sourcetypes?!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68502#M17183</link>
      <description>&lt;P&gt;Answer by esix [Splunk] should have been the selected answed and is actually best practice! &lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 17:39:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/68502#M17183</guid>
      <dc:creator>chutuo</dc:creator>
      <dc:date>2020-01-29T17:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: how can i list all indexes and sourcetypes?!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/555755#M157778</link>
      <description>&lt;P&gt;with group not work for me:&lt;/P&gt;&lt;P&gt;used this:&lt;/P&gt;&lt;PRE&gt;| tstats values(sourcetype) where index=* by index&lt;/PRE&gt;&lt;P&gt;you can also try this one to get indexes based on provide sourcetype in query::&lt;/P&gt;&lt;PRE&gt;| tstats values(sourcetype) where index=* sourcetype="abc" OR sourcetype="xyz" by index&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jun 2021 09:56:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/555755#M157778</guid>
      <dc:creator>hardik_d</dc:creator>
      <dc:date>2021-06-15T09:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: how can i list all indexes and sourcetypes?!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/556360#M157993</link>
      <description>&lt;P&gt;This search worked better for me over the other tstats searches. The tstats search would generate errors over too long a time.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jun 2021 19:51:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/556360#M157993</guid>
      <dc:creator>Micheal_S</dc:creator>
      <dc:date>2021-06-18T19:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: how can i list all indexes and sourcetypes?!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/556526#M158054</link>
      <description>&lt;P&gt;To expand on this. I had an issue where if I did this empty indexes wouldn't show in my results. I used the following to work around that.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eventcount summarize=false index=* 
| search NOT index IN ( &amp;lt;indexes you don't want to include&amp;gt; )
| dedup index 
| fields index
| map maxsearches=100 search="|metadata type=sourcetypes index=\"$index$\" | eval index=\"$index$\""
| fields index sourcetype 
| append [| eventcount summarize=false index=* 
| search NOT index IN (
&amp;lt;indexes you don't want to include&amp;gt;
)
| dedup index 
| fields index] 
| fillnull value="No Known SourceTypes" 
|  stats count as mc values(sourcetype) as sourcetype by index 
| stats count values(mc) as mc by index sourcetype
| eval sourcetype = if(sourcetype=="No Known SourceTypes" AND mc&amp;gt;1, NULL,sourcetype) 
| dedup index sourcetype 
| fields index sourcetype &lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 21 Jun 2021 14:03:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-list-all-indexes-and-sourcetypes/m-p/556526#M158054</guid>
      <dc:creator>Micheal_S</dc:creator>
      <dc:date>2021-06-21T14:03:48Z</dc:date>
    </item>
  </channel>
</rss>

