<?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 do you list Index, sourcetype and source using the REST command? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-list-Index-sourcetype-and-source-using-the-REST/m-p/423198#M121468</link>
    <description>&lt;P&gt;Don't know why, but I have to select "all time" to get all index, sourcetype and source mapping using tstats command&lt;/P&gt;</description>
    <pubDate>Wed, 06 Mar 2019 17:17:37 GMT</pubDate>
    <dc:creator>harshal_chakran</dc:creator>
    <dc:date>2019-03-06T17:17:37Z</dc:date>
    <item>
      <title>How do you list Index, sourcetype and source using the REST command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-list-Index-sourcetype-and-source-using-the-REST/m-p/423194#M121464</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am working to list all the index with underlying sourcetypes and sources in it.&lt;/P&gt;

&lt;P&gt;For which I am currently using the following command to run &lt;STRONG&gt;All Time&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats values(source) as source where index = * by index, sourcetype
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem is that I have to run this search in the all time range, which is a heavy load and slow too.&lt;/P&gt;

&lt;P&gt;Is there any &lt;CODE&gt;|rest&lt;/CODE&gt; command to get results in much faster or any other command where I don't have to run search with an all time duration?&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 08:50:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-list-Index-sourcetype-and-source-using-the-REST/m-p/423194#M121464</guid>
      <dc:creator>harshal_chakran</dc:creator>
      <dc:date>2019-03-06T08:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do you list Index, sourcetype and source using the REST command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-list-Index-sourcetype-and-source-using-the-REST/m-p/423195#M121465</link>
      <description>&lt;P&gt;Did you try with summariesonly?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | tstats `summariesonly` values(source) as source where index = * groupby index, sourcetype
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Mar 2019 09:46:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-list-Index-sourcetype-and-source-using-the-REST/m-p/423195#M121465</guid>
      <dc:creator>lakshman239</dc:creator>
      <dc:date>2019-03-06T09:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do you list Index, sourcetype and source using the REST command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-list-Index-sourcetype-and-source-using-the-REST/m-p/423196#M121466</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
cannot find such macro ´summariesonly´.&lt;/P&gt;

&lt;P&gt;Ran this search though&lt;BR /&gt;
    | tstats summariesonly=true values(source) as source where index = * groupby index, sourcetype&lt;/P&gt;

&lt;P&gt;However, the problem is the same, that I have to run it &lt;STRONG&gt;all time&lt;/STRONG&gt; to get all results.&lt;BR /&gt;
Looking for more like a rest command, so can run for last 15 mins, etc.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 10:51:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-list-Index-sourcetype-and-source-using-the-REST/m-p/423196#M121466</guid>
      <dc:creator>harshal_chakran</dc:creator>
      <dc:date>2019-03-06T10:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do you list Index, sourcetype and source using the REST command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-list-Index-sourcetype-and-source-using-the-REST/m-p/423197#M121467</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;´summariesonly´ is in SA-Utils, but same as what you have now. tstats does support the search to run for last 15mins/60 mins, if that helps.

not sure if there is a direct rest api. One option would be to pull all indexes using rest and then use that on tstats, perhaps?

|rest /services/data/indexes | table title
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Mar 2019 11:20:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-list-Index-sourcetype-and-source-using-the-REST/m-p/423197#M121467</guid>
      <dc:creator>lakshman239</dc:creator>
      <dc:date>2019-03-06T11:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do you list Index, sourcetype and source using the REST command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-list-Index-sourcetype-and-source-using-the-REST/m-p/423198#M121468</link>
      <description>&lt;P&gt;Don't know why, but I have to select "all time" to get all index, sourcetype and source mapping using tstats command&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 17:17:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-list-Index-sourcetype-and-source-using-the-REST/m-p/423198#M121468</guid>
      <dc:creator>harshal_chakran</dc:creator>
      <dc:date>2019-03-06T17:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do you list Index, sourcetype and source using the REST command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-list-Index-sourcetype-and-source-using-the-REST/m-p/747204#M241781</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/177803"&gt;@lakshman239&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I am working on something similar. I have a dashboard which is simply showing all the indexes, its sourcetypes, source_counts and host_counts using tstats query-&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats values(sourcetype) as sourcetypes dc(host) as hosts_count dc(source) as sources_count where index = * by index&lt;/LI-CODE&gt;&lt;P&gt;I am thinking to use rest query to&amp;nbsp;&lt;SPAN&gt;populate the indexes in the dropdown and use then use that on tstats to show the sourcetypes/hosts for a particular index you pick in the dropdown.&lt;BR /&gt;Can you help here how you are suggesting using the output of rest api into tstats.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt; | rest splunk_server=local /services/cluster_blaster_indexes/sh_indexes_manager/
| stats count by title 
| fields - count&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;P.S. I am fairly new to splunk!&lt;/P&gt;</description>
      <pubDate>Thu, 29 May 2025 14:02:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-list-Index-sourcetype-and-source-using-the-REST/m-p/747204#M241781</guid>
      <dc:creator>mchoudhary</dc:creator>
      <dc:date>2025-05-29T14:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do you list Index, sourcetype and source using the REST command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-list-Index-sourcetype-and-source-using-the-REST/m-p/747249#M241785</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/276624"&gt;@mchoudhary&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;You can try below sample xml dashboard code&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;form&amp;gt;&lt;BR /&gt;&amp;lt;label&amp;gt;Index Sourcetype and Host/Source Explorer&amp;lt;/label&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;fieldset submitButton="false" autoRun="true"&amp;gt;&lt;BR /&gt;&amp;lt;input type="dropdown" token="selectedIndex" searchWhenChanged="true"&amp;gt;&lt;BR /&gt;&amp;lt;label&amp;gt;Select Index:&amp;lt;/label&amp;gt;&lt;BR /&gt;&amp;lt;choice value="*"&amp;gt;All&amp;lt;/choice&amp;gt;&lt;BR /&gt;&amp;lt;search&amp;gt;&lt;BR /&gt;&amp;lt;query&amp;gt;&lt;BR /&gt;| rest splunk_server=local /services/data/indexes&lt;BR /&gt;| search disabled=0&lt;BR /&gt;| stats count by title&lt;BR /&gt;| fields title&lt;BR /&gt;| rename title as index_name&lt;BR /&gt;&amp;lt;/query&amp;gt;&lt;BR /&gt;&amp;lt;earliest&amp;gt;-1s&amp;lt;/earliest&amp;gt;&lt;BR /&gt;&amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;&lt;BR /&gt;&amp;lt;/search&amp;gt;&lt;BR /&gt;&amp;lt;fieldForLabel&amp;gt;index_name&amp;lt;/fieldForLabel&amp;gt;&lt;BR /&gt;&amp;lt;fieldForValue&amp;gt;index_name&amp;lt;/fieldForValue&amp;gt;&lt;BR /&gt;&amp;lt;default&amp;gt;*&amp;lt;/default&amp;gt;&lt;BR /&gt;&amp;lt;/input&amp;gt;&lt;BR /&gt;&amp;lt;/fieldset&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;row&amp;gt;&lt;BR /&gt;&amp;lt;panel&amp;gt;&lt;BR /&gt;&amp;lt;table&amp;gt;&lt;BR /&gt;&amp;lt;title&amp;gt;Details for Index: $selectedIndex$&amp;lt;/title&amp;gt;&lt;BR /&gt;&amp;lt;search&amp;gt;&lt;BR /&gt;&amp;lt;query&amp;gt;&lt;BR /&gt;| tstats values(sourcetype) as sourcetypes,&lt;BR /&gt;dc(host) as host_count,&lt;BR /&gt;dc(source) as source_count&lt;BR /&gt;where index="$selectedIndex$" &amp;lt;!-- Use the token here --&amp;gt;&lt;BR /&gt;by index&lt;BR /&gt;| eval sourcetypes = mvjoin(sourcetypes, ", ")&lt;BR /&gt;&amp;lt;/query&amp;gt;&lt;BR /&gt;&amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;&lt;BR /&gt;&amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;&lt;BR /&gt;&amp;lt;/search&amp;gt;&lt;BR /&gt;&amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="count"&amp;gt;20&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="refresh"&amp;gt;5m&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="refresh.auto.interval"&amp;gt;300&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;/table&amp;gt;&lt;BR /&gt;&amp;lt;/panel&amp;gt;&lt;BR /&gt;&amp;lt;/row&amp;gt;&lt;BR /&gt;&amp;lt;/form&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Regards,&lt;/STRONG&gt;&lt;BR /&gt;Prewin&lt;BR /&gt;Splunk Enthusiast | Always happy to help! If this answer helped you, please consider marking it as the solution or giving a kudos/Karma. Thanks!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 May 2025 04:44:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-list-Index-sourcetype-and-source-using-the-REST/m-p/747249#M241785</guid>
      <dc:creator>PrewinThomas</dc:creator>
      <dc:date>2025-05-30T04:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do you list Index, sourcetype and source using the REST command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-list-Index-sourcetype-and-source-using-the-REST/m-p/747262#M241790</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/28010"&gt;@PrewinThomas&lt;/a&gt;&amp;nbsp;, yes that the correct way. I was able to figure it out yesterday &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;form version="1.1" theme="dark"&amp;gt;
  &amp;lt;label&amp;gt;Health Log Source Analysis&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;&amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;input type="multiselect" token="selected_index" searchWhenChanged="true"&amp;gt;
        &amp;lt;label&amp;gt;Select Index(es)&amp;lt;/label&amp;gt;
        &amp;lt;choice value="*"&amp;gt;All&amp;lt;/choice&amp;gt;
        &amp;lt;fieldForLabel&amp;gt;index&amp;lt;/fieldForLabel&amp;gt;
        &amp;lt;fieldForValue&amp;gt;index&amp;lt;/fieldForValue&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| rest splunk_server=local /services/data/indexes
| fields title
| rename title as index
| sort index&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/input&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;title&amp;gt;Index and Sourcetypes&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| tstats values(sourcetype) as sourcetypes dc(host) as hosts_count dc(source) as sources_count where index IN($selected_index$) by index&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;that's the query I used which worked.&lt;/P&gt;</description>
      <pubDate>Fri, 30 May 2025 11:24:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-list-Index-sourcetype-and-source-using-the-REST/m-p/747262#M241790</guid>
      <dc:creator>mchoudhary</dc:creator>
      <dc:date>2025-05-30T11:24:20Z</dc:date>
    </item>
  </channel>
</rss>

