Splunk Search

How can I search for same values within a field

ynag
Explorer

Hi, 

I have a field with multiple values, some of them share the same characters at the beginning of the values. 

I need to find those with the same values and make it possible to choose how many characters I want to compare from the beginning of the value.

Labels (2)
Tags (2)
0 Karma

manjunathmeti
Champion

hi @ynag ,

You can use substr function to get the first n characters. Below query get first 5 characters from myfield values. 

index=index
| eval substr=substr(myfield, 0, 5) 
| stats list(myfield), count by substr

 

If this reply helps you, an upvote/like would be appreciated. 

0 Karma
Get Updates on the Splunk Community!

Splunk at Cisco Live 2025: Learning, Innovation, and a Little Bit of Mr. Brightside

Pack your bags (and maybe your dancing shoes)—Cisco Live is heading to San Diego, June 8–12, 2025, and Splunk ...

Splunk App Dev Community Updates – What’s New and What’s Next

Welcome to your go-to roundup of everything happening in the Splunk App Dev Community! Whether you're building ...

The Latest Cisco Integrations With Splunk Platform!

Join us for an exciting tech talk where we’ll explore the latest integrations in Cisco + Splunk! We’ve ...