Splunk Search

How to count the number of times each name is repeated?

feelcool
Explorer

I have the following csv file:

 

 

id,name,age,male
1,lily,10,girl
2,bob,12,boy
3,lucy,12,girl
4,duby,10,boy
5,bob,11,boy
6,bob,10,boy
7,lucy,11,girl

 

 

Now, I want to use splunk to count the number of times each name is repeated, and the result after counting should be as follows:

 

 

id,name,age,male,result
1,lily,10,girl,1
2,bob,12,boy,3
3,lucy,12,girl,2
4,duby,10,boy,1
5,bob,11,boy,3
6,bob,10,boy,3
7,lucy,11,girl,2

 

 

 

How can I use SPL to accomplish this task?

 

Labels (3)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Try the eventstats command.

| eventstats count as result by name

 

---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...