Splunk Search

Need help with a greater than in seconds

trehman
New Member

My search alert filter: host=web-* "\"response_code\": 5*," OR "\"message\": \"Application Error\"" OR "\"response_code\": 0"\"total_time\" userloans

QUESTION. I need to modify my alert so it captures all responses that has greater than total_time of 9 secs (below sample). What should I add to capture this to my alert above? Any help would be great!

E, [2017-02-11T03:09:33.426066 #58] ERROR -- : {
"url": "http://12345/A.v.x455.adfadfr.co/loans/userloans",
"method": "get",
"request_headers": {
"Content-Type": "application/json",
"client_ip": "[FILTERED]",
},
"request_body": null,
"response_code": 0,
"response_body": "",
"total_time": 9.0,
"starttransfer_time": 0.0,
"appconnect_time": 0.0,
"pretransfer_time": 0.0001,
"connect_time": 0.0,
"namelookup_time": 0.0,
"redirect_time": 0.0
}

Tags (1)
0 Karma

gokadroid
Motivator

Hope this helps:

host=web- "\"response_code\": 5," OR "\"message\": \"Application Error\"" OR "\"response_code\": 0"\"total_time\" userloans
| rex field=_raw "\"total_time\":\s*(?<totalTime>[^,\s]+)"
| where totalTime > 9
0 Karma

pradeepkumarg
Influencer

If you don't have it already, you need to extract the total time into a field like below and filter on it

your base search | rex "(?i)\Wtotal_time\W{2}(?P<TOTAL_TIME>\.\S+)\," | where TOTAL_TIME > 9

The above rex might not be perfect, but you get the idea

0 Karma
Get Updates on the Splunk Community!

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...