DevOps & Observability
DevOps, AppDev, and tool-chains, oh my!

How to search for fields that contains number in the form of a string

namanbharti9
Engager

Hi All,

I'm trying to form a query for searching only specific fields, wherein there are numbers after a specific piece of text. To provide an example, I am currently using the following query:

host="xyz-*" apple "retry *"

I have to find specific entries that have this in their result: "retry 1" or "retry 2" or "retry 3" etc. up to I don't know how many retries.

But the problem that I'm facing is that the above query is also displaying results which have "retry banana", "retry mango" etc. too.

Can someone help me please?

Thanks

Tags (3)
0 Karma

thambisetty
SplunkTrust
SplunkTrust
host="xyz-*" 
| regex _raw="retry\s\d+"
————————————
If this helps, give a like below.
0 Karma

thambisetty
SplunkTrust
SplunkTrust

is that retry assigned to some field?

for example, if value retry 1 or retry 2 are assigned to field "retry" then you can use regex

host="xyz-*" apple 
| regex retry="retry\s\d+"
————————————
If this helps, give a like below.

namanbharti9
Engager

Thanks for the reply, @thambisetty .

Unfortunately, it is not assigned to a field but is just a value in the search. Anyway, I have been able to get past this issue by leveraging some "(" brackets that were included in the search.

However, I have one more question.

I am trying to see results that contain anything but "retry 1". So I thought something along the lines of this:

host="xyz-*" apple "(retry *)" !"(retry 1)"

But as you would have guessed, it doesn't work.

How can I see all results which include "retry 2", "retry 3" and so on except "retry 1"?

0 Karma
Get Updates on the Splunk Community!

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...