Splunk Search

srchIndexesDefault parameter is not respected when srchFilter is defined

sylim_splunk
Splunk Employee
Splunk Employee

We noticed that when a srchFilter is configured for a role in authorize.conf, the srchIndexesDefault setting is ignored unless the srchFilter contains the wildcard(*) character by itself.

As a result, all indexes a user is allowed to access are searched when the index clause is not specified in the query.

Regardless of the srchFilter definition, srchIndexesDefault should be respected when the index clause is not explicity specified in the query.

Here's what I did;

  1. Define two indexes, i.e. index4test1 and index4test2.
  2. Configure the user role as below: [role_user] srchIndexesDefault = index4test2 srchFilter = index!=main
  3. Perform the following example search: earliest=-1d |stats count by index
  4. Output is both index4test1 and index4test2 instead of just index4test2.

If the srchFilter is removed altogether or a wildcard character is included, the results is index4test2 as expected. This works as designed for the admin role as it has srchFilter = *.

Tags (1)
1 Solution

sylim_splunk
Splunk Employee
Splunk Employee

As per our doc - I agree it's not very clear, the srchIndexesDefault is used when there is no index listed in the search but when you use srchFilter with index, like "index!=main" which is eventually added into the search, " index!=main ". Because of this replacement the srchIndexesDefault will not be considered during the search time.

Here's excerpts from doc

srchIndexesDefault = semicolon-separated list
A list of indexes to search when no index is specified.

To work around it, adjust srchIndexesAllowed and srchIndexesDisallowed so that it doesn't include the indexes you do not want for the roles, or change your searches to explicitly specify the index(es) that a search should look at.

https://docs.splunk.com/Documentation/Splunk/latest/Admin/authorizeconf

 

View solution in original post

sylim_splunk
Splunk Employee
Splunk Employee

As per our doc - I agree it's not very clear, the srchIndexesDefault is used when there is no index listed in the search but when you use srchFilter with index, like "index!=main" which is eventually added into the search, " index!=main ". Because of this replacement the srchIndexesDefault will not be considered during the search time.

Here's excerpts from doc

srchIndexesDefault = semicolon-separated list
A list of indexes to search when no index is specified.

To work around it, adjust srchIndexesAllowed and srchIndexesDisallowed so that it doesn't include the indexes you do not want for the roles, or change your searches to explicitly specify the index(es) that a search should look at.

https://docs.splunk.com/Documentation/Splunk/latest/Admin/authorizeconf

 

gjanders
SplunkTrust
SplunkTrust

If you believe the docs should be more clear feel free to send constructive feedback via the documentation page! Perhaps it could mention srchFilters may change this ?

0 Karma
Get Updates on the Splunk Community!

Financial Services Industry Use Cases, ITSI Best Practices, and More New Articles ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Splunk Federated Analytics for Amazon Security Lake

Thursday, November 21, 2024  |  11AM PT / 2PM ET Register Now Join our session to see the technical ...

Splunk With AppDynamics - Meet the New IT (And Engineering) Couple

Wednesday, November 20, 2024  |  10AM PT / 1PM ET Register Now Join us in this session to learn all about ...