Splunk Search

Create Search for a Host who dont send Data for x minutes in the last 10 Days

mklhs
Path Finder

Hello,

i wanted to write a search which will return all hosts which have not sent any events for 10 minutes in the last 10 days.
Normally the servers send every minute.

0 Karma
1 Solution

mklhs
Path Finder

Hello Guys,

i got it with that query:

index= sourcetype= | eval age = (now() - _time ) | stats first(age) as age, first(_time) as LastTime by xxx | convert ctime(lastTime) as "Last Active On" | eval Status=case(age < 600, "running",age > 600,"Down"

with the last eval i have determined from when a server counts as not available for me

I hope it Helps someone

Thanks @renjith.nair

View solution in original post

0 Karma

mklhs
Path Finder

Hello Guys,

i got it with that query:

index= sourcetype= | eval age = (now() - _time ) | stats first(age) as age, first(_time) as LastTime by xxx | convert ctime(lastTime) as "Last Active On" | eval Status=case(age < 600, "running",age > 600,"Down"

with the last eval i have determined from when a server counts as not available for me

I hope it Helps someone

Thanks @renjith.nair

0 Karma

renjith_nair
Legend

@mklhs,

Try

    | metadata type=hosts where index=* OR index=_*|eval delay=round((now()-lastTime)/60)|where delay >10| fields host,delay
---
What goes around comes around. If it helps, hit it with Karma 🙂

mklhs
Path Finder

Thank you!
but if I now have a time interval we say from last week Wednesday to yesterday how would I change the query? somehow that doesn't quite want to be me

0 Karma

renjith_nair
Legend

@mklhs,

Try this with time range

tstats count,max(_time) as _time where index=* by host | eval delay=(now()-_time)/60
---
What goes around comes around. If it helps, hit it with Karma 🙂
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.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 ...