Search code examples
splunksplunk-query

Splunk: List indexes and sources to which one has access


Using this search command

| eventcount summarize=false | dedup index | fields index

I get a list of all indexes I have access to in Splunk. Is it also possible to get another column besides this within which the source for the index is visible too?

EDIT: It seems like I found a solution:

| tstats count WHERE index=* sourcetype=* source=* by index, sourcetype, source | fields - count

This gives back a list with columns for indexes, sourcetypes and sources.


Solution

  • In case the permissions to read sources are not enforced by the tstats, you can join to your original query with an inner join on index, to limit to the indexes that you can see:

    | tstats count WHERE index=* OR index=_* by index source 
    | dedup index source | fields index source 
    | join type=inner index [| eventcount summarize=false | dedup index | fields index]