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!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...