Splunk Search

How to write a search to return events with a variable field value greater than a certain number?

snabel
Path Finder

Hi,

I've this log entry:

"2014-11-22 02:42:10,545 .. - average:2.74425 , min:1.43 , max:4.007..."

i want to create a search query that returns all log entries with "average > 5"

i want to select the date of the log entry and the average value,

can this be done? how can i do this?

Thanks,
Snabel

Tags (1)
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

Sure:

index=foo sourcetype=bar average>5 | table _time average

View solution in original post

snabel
Path Finder

i think i found it:
language: (?[a-z][a-z]+-+[a-z][a-z]*)

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Sure:

index=foo sourcetype=bar average>5 | table _time average

snabel
Path Finder

Thanks it worked 🙂

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Did you already extract the average field?

If not, go to Settings -> Fields -> Field Extractions -> New, enter "average" as name, fill in your sourcetype, and use this as inline extraction:

average:(?<average>\d+\.?\d*)

Then try again. By default, Splunk extracts key=value but not key:value.

snabel
Path Finder

it didn't work. i got:
No results found.

even though i have many log entries:
"2014-11-22 02:42:10,545 .. - average:5.34425 , min:1.43 , max:4.007..."
"2014-11-22 02:42:10,545 .. - average:5.36425 , min:1.43 , max:4.007..."

0 Karma
Get Updates on the Splunk Community!

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...