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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...