The most efficient way to get accurate results is probably:
| eventcount summarize=false index=* | dedup index | fields index
Just searching for index=*
could be inefficient and wrong, e.g., if one index contains billions of events in the last hour, but another's most recent data is back just before midnight, you would either miss out on the second index, or have to retrieve all billions of events just to discover it.
Update:
Corrected to include index=*
.
If you want to include internal indexes, you can use:
| eventcount summarize=false index=* index=_* | dedup index | fields index
I'm really surprised no-one came up with yet another example for this:
| tstats count WHERE index=* by index | table index
Like the REST call, it is also lightning fast 😉
cheers, MuS
It will pretty late for the answer : but i have done this through this
index=*|stats count by index|fields index
This isn't the most, inefficient, obfuscated method to do this... but this search should not be used to find index names... ever... in my humble opinion.
Brand new stupid user here, my results:
1st suggestion:
| eventcount summarize=false index=* index=_* | dedup index | fields index
= error in eventcount command: this command is not supported in a real-time search
index=* | dedup index | fields index
This works, but doesn't give you a nice list, rather provides tons of individual lines of data
$SPLUNK_HOME/bin/splunk list index
No results at all.
So for me, again newbie here none of these worked for me..
Check out MuS's answer. It's the best one for this, and works just fine.
and another one
| REST /services/data/indexes | table title
Yes, this is very performant and I like it as well.
The drawback is that it gives all indexes, not only the ones the user is allowed to see.
You could use dbinspect to get a list of indexes the user has access to
|dbinspect index=*
| REST /services/data/indexes | table title, currentDBSizeMB
If you want to add the size of the index as well.
very nice indeed! thank you .. here is a slight modification.
| REST /services/data/indexes | dedup title | sort title | table title
Sweet solution!
best answer in my opinion
I like this !
$SPLUNK_HOME/bin/splunk list index
The most efficient way to get accurate results is probably:
| eventcount summarize=false index=* | dedup index | fields index
Just searching for index=*
could be inefficient and wrong, e.g., if one index contains billions of events in the last hour, but another's most recent data is back just before midnight, you would either miss out on the second index, or have to retrieve all billions of events just to discover it.
Update:
Corrected to include index=*
.
If you want to include internal indexes, you can use:
| eventcount summarize=false index=* index=_* | dedup index | fields index
I downvoted this post because the rest answer is the better one. it is more efficient and will include all indices, even empty ones.
I now hardcoded the index names in a StaticSelect for performance reasons ^^ Technically not pretty but efficient and solves my problem 🙂
old post,... but,... may i know whats "StaticSelect" (if its still not deprecated)
It is not correct that you will only see local indexes. the eventcount
command will return all indexes that can be searched, local or remote distributed ones. But yes, it will only list ones that are accessible to the running user. It is true that Splunk's UI, API, and Management GUI does not provide a way to bypass security restrictions to allow people to list indexes they do not have access to.
This will not work. Such a search will only return events indexed locally, and therefore you have the potential to miss a bunch of indexes.
index=* | dedup index | fields index
run over all time
Would be better (in terms of getting all a complete list of indexes), but is not very efficient, it will only show indexes the person running the search has access to.
I don't believe Splunk has a reliable way to get a list of all current indexes through the web GUI (even the management section can be lacking in certain cases).