Splunk Search

Case insensitive field value results in a count

sdettling
New Member

How can I make the results of a count on the user field case insensitive?

index=winevents sourcetype="WinEventLog:Security" Keywords="Audit Failure" | fields user, count

I get results like:

User:
JDoe
jdoe
MSmith
msmith

I'd rather that user field consolidate those values/

I think this is done with the eval argument, but I don't know the syntax.

Tags (1)
0 Karma

martin_mueller
SplunkTrust
SplunkTrust

I think you meant | stats count by user rather than | fields?

That being said, yeah - stats is case sensitive. In fact, virtually everything in Splunk searches is case sensitive except the search command with regards to values... so you can | search log_level="error" and find ERROR, but can't | search loG_level="error" because field names are always case sensitive and can't | where log_level="error" because it's not search.

You can normalize field values to either lower or upper case before sending them into stats like this:

... | eval user = lower(user) | stats count by user
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...