Splunk Search

Search for all events that has part of a string in a field

ram_sistla
Engager

I am looking for how to search for all events where a field might have values of sub-string.

For Example if I have a string abc123 and the test_data field has the below values

ab
abc
12
ab1
bc2

Expected result after search is

ab

abc
12

Tags (1)
0 Karma

praphulla1
Path Finder

You can use any string comparison functions or use a wild character to match your search criteria

search  test_data=ab*

Refer to the string comparison functions @ https://docs.splunk.com/Documentation/Splunk/7.3.0/SearchReference/ConditionalFunctions

0 Karma

Sukisen1981
Champion

The like operator is your friend

|where like (searchstring,"tesdatafield%") OR like(searchstring,"%tesdatafield") OR like(searchstring,"%tesdatafield%")

Here search string is abc123 and the 3 combinations of OR make sure to search for - starts with, ends with or contains

0 Karma

Sukisen1981
Champion

hi @ram_sistla
Please let us know if your issue has been resolved and accept the answer if it significantly helped your resolution. Do not forget to add additional resolution details for the benefit of other form members.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...