Getting Data In

Is there a way to list all reports using one specific sourcetype or index?


As title, Is there a way to list all the reports using one specific sourcetype or index?

Tags (3)
0 Karma


Well, one unreliable method would be to go to Settings > Searches and Reports, and use the search bar at the top right to search for sourcetype="foo". One problem is that some searches might use macros, or they might use wildcards in their sourcetype searchterms, or the search might not use quotes around the sourcetype value. Each of those scenarios would result in a search not matching although technically that search does itself match events of that sourcetype or index.

Also sometimes the admin section search can match a little too liberally (I think it searches the raw atomfeeds, so if you search for structural words in the api feeds like "EAI" or "value" or "values", you'll always get all the results to match =/ )

A different approach might be to use the rest search command to pull all the searches and reports out of the API and then filter on them.

| rest /services/saved/searches | table title search eai:acl.owner eai:acl.sharing *

However basically all three problems persist - macros, wildcards and presence/absence of quotes.

We can deal with the quotes problem with an OR

| rest /services/saved/searches 
| table title search eai:acl.owner eai:acl.sharing * 
| search search="*index=\"_internal\"*" OR search="*index=_internal*"

Otherwise, in theory we could deal with the macros problem by also using the rest command to pull out all the macros, use the append command to stick those on the end. Then make a multiple match regex to pull multivalue macro_name field out of our searches, normalize the macro_name vs "name" field with eval so they match. Then use eventstats by macro_name to roll up for every search, which macros it uses. Then we could make a big fake string-valued field that gloms together the raw search with the 0-n macros, and then filter against that constructed field. But that would be crazy. And we still wouldnt deal with the case where a search did things like sourcetype="access_*"

Short Answer:
if the searches dont use macros and dont use wildcards in sourcetype terms, yes!

On the other hand if they do use macros and/or wildcarded values, then no not really.

0 Karma
Get Updates on the Splunk Community!

Don't wait! Accept the Mission Possible: Splunk Adoption Challenge Now and Win ...

Attention everyone! We have exciting news to share! We are recruiting new members for the Mission Possible: ...

Unify Your SecOps with Splunk Mission Control

In today’s post, I'm excited to share some recent Splunk Mission Control innovations. With Splunk Mission ...

Data Preparation Made Easy: SPL2 for Edge Processor

By now, you may have heard the exciting news that Edge Processor, the easy-to-use Splunk data preparation tool ...