Splunk Enterprise

How to count the uptime of Websites?

tobi2k
Explorer

Hi There!
I am collecting every 2 minutes the response_code of several websites. In my Dashboard I want to have just two Numbers "X Websites up" and "X Websites down" in realtime.

The Logic is:
Response_code=200 means Website is up
Response_code!=200 means Website is down

How should the query looks like?
index="main" sourcetype="web_ping" response_code="200" delivers all Responses. But how can I count only the Sourcetype?
| stats count by sourcetype delivers the sum of all querys and not the unique Websites.

Help is very appreachiated... Thank you!

Labels (2)

renjith_nair
Legend

@tobi2k ,

Does this work for you ?

index="main" sourcetype="web_ping" |stats latest(response_code) as response_code by <replace with your website field>
|stats count(eval(response_code==200)) as "Websites Up",count(eval(response_code!=200))  as  "Websites Down"
---
What goes around comes around. If it helps, hit it with Karma 🙂

tobi2k
Explorer

Awesome! That has solved my issue!

0 Karma

renjith_nair
Legend

@tobi2k , Glad that it worked 🙂 . Please accept as answer to close the thread

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma
Get Updates on the Splunk Community!

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...