Splunk Search

Help with splunk query, searchmatch finding false positives

hamishcross
Engager

Hey All,

Very new to using splunk and love the power of dashboards.

I'm executing the following

index=my_app ("C4C Auth Scenario")| stats count(eval(searchmatch("C4C Auth Scenario 1"))) as "S1", count(eval(searchmatch("C4C Auth Scenario 2"))) as "S2", count(eval(searchmatch("C4C Auth Scenario 3"))) as "S3", count(eval(searchmatch("C4C Auth Scenario 4Y"))) as "S4Y", count(eval(searchmatch("C4C Auth Scenario 4N"))) as "S4N", count(eval(searchmatch("C4C Auth Scenario 5"))) as "S5", count(eval(searchmatch("C4C Auth Scenario 6"))) as "S6" | untable blank Reason Count | table Reason Count

And I'm finding that S6 is returning false positives.

If I execute index=my_app "C4C Auth Scenario 6" no results are returned.

Yet if I execute the full query above, it returns multiple rows in the count

What would the cause of this be, and how do I go about ensuring it doesn't occur.

I'm looking to create a dashboard based on the occurrence of logging events.

Any help would be greatly appreciated.

0 Karma
1 Solution

FrankVl
Ultra Champion

I don't have an immediate answer for the difference in search results and the 'false positives' you experienced. Are you sure both searches were ran over the same time window?

Anyway, I would solve this by extracting the scenario 'number' into a field and then doing a stats by that field.

For example (you want to implement this with automatic field extractions in the end, so you don't need the line with the rex command anymore):

index=my_app ("C4C Auth Scenario")
| rex "C4C Auth Scenario (?<Reason>\w+)"
| stats count by Reason

View solution in original post

FrankVl
Ultra Champion

I don't have an immediate answer for the difference in search results and the 'false positives' you experienced. Are you sure both searches were ran over the same time window?

Anyway, I would solve this by extracting the scenario 'number' into a field and then doing a stats by that field.

For example (you want to implement this with automatic field extractions in the end, so you don't need the line with the rex command anymore):

index=my_app ("C4C Auth Scenario")
| rex "C4C Auth Scenario (?<Reason>\w+)"
| stats count by Reason

hamishcross
Engager

Thanks mate, that worked pretty well. Only thing I would say is I had to remove the "index=my_app" after rex to make it work. Was this in error or have I made a mistake?

0 Karma

FrankVl
Ultra Champion

Oh, yeah, copy paste mistake. Let me update it to prevent confusion if someone else reads this in the future 🙂

0 Karma

hamishcross
Engager

Awesome! For newbies like me, if it doesn't work, finding the problem can be really problematic. So really good to ensure the examples work. Thanks again

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...