Splunk Search

Wildcard Match Count

AHEARNJ
Explorer

I am trying to use a match, regex, or eval with a stats count.
I have multiple values that are similar that are in the same column along with other values that I want kept.
Here is an example of some of the data

name="User: Employee FirstName LastName", 
name="User: Employee FirstName1 LastName1",
name="User: Employee FirstName2 LastName2",
name="Office 365"
name="Word"
name="Google"

I would like to be able to do a

... | stats count by name eval User [regex] replace ""User: Employee FirstName LastName"...  x3  with User

Results:
Office 365 1
Word 1
Google 1
User 3
I have tried many ways, but can't seem to get this to work as I would like.

Thanks in advance for any help you can provide...

0 Karma
1 Solution

DalJeanis
SplunkTrust
SplunkTrust

Assuming that you want every user to come out on the same line, labeled as User...

Try this -

 | rex mode=sed field=name "s/^User.*$/User/"
 | stats count by name

View solution in original post

0 Karma

DalJeanis
SplunkTrust
SplunkTrust

Assuming that you want every user to come out on the same line, labeled as User...

Try this -

 | rex mode=sed field=name "s/^User.*$/User/"
 | stats count by name
0 Karma

AHEARNJ
Explorer

Thanks DalJeanis that was quick and exactly what I needed.

DalJeanis
SplunkTrust
SplunkTrust

We're happy to help.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...