<?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: identifying sourcetypes by index in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113511#M23770</link>
    <description>&lt;P&gt;Thanks alot, This is more accurate and truly fast&lt;/P&gt;</description>
    <pubDate>Sun, 01 Jul 2018 09:16:49 GMT</pubDate>
    <dc:creator>sojnv</dc:creator>
    <dc:date>2018-07-01T09:16:49Z</dc:date>
    <item>
      <title>identifying sourcetypes by index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113502#M23761</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I'd like to display all sourcetypes available for each index in my environment.  Unfortunately, metadata type=sourcetypes doesn't preserve the index name, and I want to be able to run it on the entire set of indexes on whatever instance the search runs on (i.e. I don't want to hardcode index=a OR index=b, etc, into the search).  I tried getting fancy:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE&gt;&lt;BR /&gt;
| rest /services/data/indexes | rex field=id mode=sed "s/.&lt;EM&gt;\/(\w+)$/\1/" | search id!="_&lt;/EM&gt;" | fields id | map search="|metadata type=sourcetypes index=$id$ | stats list(sourcetype) as sourcetype | eval whereFrom=$id$ | table sourcetype whereFrom"&lt;BR /&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;
...but the second $id$ is always null.  Can anyone give me a good way to list all indexes and the sourcetypes they contain?  As a bonus, if you can explain why my map command doesn't work as expected, I'd appreciate it.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2014 19:00:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113502#M23761</guid>
      <dc:creator>cphair</dc:creator>
      <dc:date>2014-01-14T19:00:07Z</dc:date>
    </item>
    <item>
      <title>Re: identifying sourcetypes by index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113503#M23762</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;earliest=-5m@m latest=@m index=*|dedup sourcetype|table index sourcetype 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;UL&gt;
&lt;LI&gt;I always use this to list all sourcetypes and there respective indexes. &lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Tue, 14 Jan 2014 19:10:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113503#M23762</guid>
      <dc:creator>theouhuios</dc:creator>
      <dc:date>2014-01-14T19:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: identifying sourcetypes by index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113504#M23763</link>
      <description>&lt;P&gt;That only works if all the sourcetypes have appeared in the past five minutes, though.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2014 19:11:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113504#M23763</guid>
      <dc:creator>cphair</dc:creator>
      <dc:date>2014-01-14T19:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: identifying sourcetypes by index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113505#M23764</link>
      <description>&lt;P&gt;You can increase the timerange to one hour and try it. It will just take extra time to give you the result. Will depend on your splunk environment on how much time it will take for search to complete&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2014 19:14:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113505#M23764</guid>
      <dc:creator>theouhuios</dc:creator>
      <dc:date>2014-01-14T19:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: identifying sourcetypes by index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113506#M23765</link>
      <description>&lt;P&gt;Understood, but my indexes are huge.  I would prefer not to search the data itself if I can avoid it--this is the kind of problem that metadata should solve.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2014 19:15:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113506#M23765</guid>
      <dc:creator>cphair</dc:creator>
      <dc:date>2014-01-14T19:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: identifying sourcetypes by index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113507#M23766</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|metasearch index=* sourcetype=* | stats count by index, sourcetype | fields - count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Jan 2014 20:18:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113507#M23766</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-01-14T20:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: identifying sourcetypes by index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113508#M23767</link>
      <description>&lt;P&gt;Perfect.  Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2014 20:25:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113508#M23767</guid>
      <dc:creator>cphair</dc:creator>
      <dc:date>2014-01-14T20:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: identifying sourcetypes by index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113509#M23768</link>
      <description>&lt;P&gt;you will get all sourcetypes faster if you do&lt;BR /&gt;
    | metadata type=sourcetypes index=*&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2015 14:16:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113509#M23768</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2015-05-27T14:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: identifying sourcetypes by index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113510#M23769</link>
      <description>&lt;P&gt;This REST search works great, and it is fast, too. I lists all sourcetypes by index and the associated event count:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rest /services/data/indexes count=0
| dedup title
| fields title
| map  [|metadata type=sourcetypes index="$title$"
        | eval type="$title$"] maxsearches=1000
| stats values(totalCount) AS EventCount values(sourcetype) AS Sourcetype by type
| rename type as index
| fields index Sourcetype EventCount
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 May 2018 23:21:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113510#M23769</guid>
      <dc:creator>wrangler2x</dc:creator>
      <dc:date>2018-05-03T23:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: identifying sourcetypes by index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113511#M23770</link>
      <description>&lt;P&gt;Thanks alot, This is more accurate and truly fast&lt;/P&gt;</description>
      <pubDate>Sun, 01 Jul 2018 09:16:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113511#M23770</guid>
      <dc:creator>sojnv</dc:creator>
      <dc:date>2018-07-01T09:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: identifying sourcetypes by index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113512#M23771</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;

&lt;P&gt;another one would be &lt;CODE&gt;tstats&lt;/CODE&gt; which is lighting fast, because it does not look at any &lt;CODE&gt;_raw&lt;/CODE&gt; data :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count WHERE index=* by sourcetype, index
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Sun, 01 Jul 2018 20:02:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113512#M23771</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2018-07-01T20:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: identifying sourcetypes by index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113513#M23772</link>
      <description>&lt;P&gt;Thanks MuS&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 04:13:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113513#M23772</guid>
      <dc:creator>sojnv</dc:creator>
      <dc:date>2018-07-02T04:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: identifying sourcetypes by index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113514#M23773</link>
      <description>&lt;P&gt;I use that as well, but I like the way this looks better:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats values(sourcetype) AS Sourcetype where index=* by index
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And yes, as MuS said, this is lightening fast. Run that and then compare against &lt;CODE&gt;|metasearch index=* sourcetype=* | stats count by index, sourcetype | fields - count&lt;/CODE&gt; which is way slow by comparison.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 17:09:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113514#M23773</guid>
      <dc:creator>wrangler2x</dc:creator>
      <dc:date>2018-07-02T17:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: identifying sourcetypes by index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113515#M23774</link>
      <description>&lt;P&gt;so true, thanks&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jul 2018 03:46:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113515#M23774</guid>
      <dc:creator>sojnv</dc:creator>
      <dc:date>2018-07-05T03:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: identifying sourcetypes by index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113516#M23775</link>
      <description>&lt;P&gt;do you have to do this search against "All Time" ?  i tried running it and got completely different results when searching ALL Time vs 15 minutes.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2019 02:22:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/identifying-sourcetypes-by-index/m-p/113516#M23775</guid>
      <dc:creator>sdewar83</dc:creator>
      <dc:date>2019-09-11T02:22:31Z</dc:date>
    </item>
  </channel>
</rss>

