Splunk Search

Can you help me fix my Splunk search?

olawalePS
Path Finder

I am trying to create an alert that triggers if a user successfully logs in without first having been successfully authenticated via MFA. The query is below:

 

index="okta" sourcetype="OktaIM2:log" outcome.result=SUCCESS description="User login to Okta" OR description="Authentication of user via MFA"
| transaction maxspan=1h actor.alternateId, src_ip
| where (mvcount(description) == 1)
| where (mvindex(description, "User login to Okta") == 0)

 

 

I keep getting the error 

 

Error in 'where' command: The arguments to the 'mvindex' function are invalid.

 

 

Please help me correct my search and explain what I am doing wrong.

Labels (2)
Tags (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

The second argument to mvindex must be an integer.  I think perhaps you want something like this:

| where (mvindex(description, mvfind(description,"User login to Okta")) == 0)

or, even better

| where (isnotnull(mvfind(description, "User login to Okta")))
---
If this reply helps you, Karma would be appreciated.

View solution in original post

inventsekar
SplunkTrust
SplunkTrust
  • Hi, I am not sure of how the two where commands are working in your SPL.

but, the mvindex second argument must be a "number". 

 

mvindex(<mv>, <start>, <end>)

This function returns a subset of the multivalue field using the start and end index values.

Usage.....The <mv> argument must be a multivalue field. The <start> and <end> indexes must be numbers.

The <mv> and <start> arguments are required. The <end> argument is optional.

 

https://docs.splunk.com/Documentation/SCS/current/SearchReference/MultivalueEvalFunctions

 

 

0 Karma

richgalloway
SplunkTrust
SplunkTrust

The second argument to mvindex must be an integer.  I think perhaps you want something like this:

| where (mvindex(description, mvfind(description,"User login to Okta")) == 0)

or, even better

| where (isnotnull(mvfind(description, "User login to Okta")))
---
If this reply helps you, Karma would be appreciated.

olawalePS
Path Finder

The first one still threw an error but the second worked fine, thanks

Get Updates on the Splunk Community!

Introducing New Splunkbase Governance!

Splunk apps are essential for maximizing the value of your Splunk Experience. Whether you’re using the default ...

Splunk Edge Processor | Popular Use Cases to Get Started with Edge Processor

Splunk Edge Processor offers more efficient, flexible data transformation – helping you reduce noise, control ...

3 Ways to Make OpenTelemetry Even Better

My role as an Observability Specialist at Splunk provides me with the opportunity to work with customers of ...