Reporting

how can i see all of the searches that are looking for a specific field?

matt
Splunk Employee
Splunk Employee

We are making some changes to our system which requires a field name in the raw event to be changed. We'd like to know the impact to all our users' searches and dashboards that make reference to the field. Is there a way to get an inventory of all the saved searches and dashboards with the field foo in the search string?

1 Solution

Flynt
Splunk Employee
Splunk Employee

You can search the in-line searches used in public views for a particular field by running the following -

 |rest /servicesNS/-/-/data/ui/views  splunk_server=local |table author eai:acl.app id eai:data title label|rex max_match=0 field=eai:data "\<query\>(?P<search_used>.*)\<\/query\>"|search search_used!=""|mvexpand search_used|fields - eai:data |table *|search search_used="*DESIREDFIELD*"

This will list all public views and their respective searches. Notice that we are only asking for the views on the LOCAL instance. If you want to search all views in all search heads remove splunk_server=local

To search public saved searches for a particular field -

|rest /servicesNS/-/-/saved/searches |fields author title qualifiedSearch |eval qualifiedSearch=lower(qualifiedSearch) |search qualifiedSearch="*DESIREDFIELD*"

View solution in original post

landen99
Motivator

The first search of the accepted answer has dashboard formatting in the regex (gt/lt) not conducive to the search line and also could benefit from using the regex command to filter:

|rest /servicesNS/-/-/data/ui/views  splunk_server=local | regex eai:data="query" | table author eai:acl.app id eai:data title label|rex max_match=0 field=eai:data "\<query\> *(?P<search_used>[^\<]+)\<\/query\>" | search search_used=* | mvexpand search_used

followed by: | regex search_used="." | fields - eai:data

Where the dot in the regex command is replaced by the fieldname token.

While it is crude to search for the name without the field usage format/context, it will work for most cases. More effort to key on field usage context would produce more accurate results.

Flynt
Splunk Employee
Splunk Employee

You can search the in-line searches used in public views for a particular field by running the following -

 |rest /servicesNS/-/-/data/ui/views  splunk_server=local |table author eai:acl.app id eai:data title label|rex max_match=0 field=eai:data "\&lt;query\&gt;(?P&lt;search_used&gt;.*)\&lt;\/query\&gt;"|search search_used!=""|mvexpand search_used|fields - eai:data |table *|search search_used="*DESIREDFIELD*"

This will list all public views and their respective searches. Notice that we are only asking for the views on the LOCAL instance. If you want to search all views in all search heads remove splunk_server=local

To search public saved searches for a particular field -

|rest /servicesNS/-/-/saved/searches |fields author title qualifiedSearch |eval qualifiedSearch=lower(qualifiedSearch) |search qualifiedSearch="*DESIREDFIELD*"
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...