Splunk Search

how to iterate a column's values like python in command?

cyberportnoc
Explorer

"daily.cld" | rex field=_raw "version: (?\d+.)," | rex field=_raw "sigs: (?\d+.)," | convert timeformat="%Y-%m-%d" ctime(_time) AS date | table source, date, version, sigs | where date=strftime(now(), "%Y-%m-%d")

is there a command like python to find missing server log file?

input a correct full list of name ["name1", "name2", "name3"]
and compare with the columns values , to find which name in full list not in the values of columns of search table

Tags (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi cyberportnoc,

create a lookup with all your servers (e.g. perimeter.csv) calling column host and possibly using only uppercase (not mandatory)
run this search:

your search
| eval host=upper(host)
| stats count by host
| append [ | inputlookup perimeter.csv | eval host=upper(host), count=0 | fields host count ]
| stats sum(count) AS Total by host
| where Total = 0

In this way you listed all missing hosts.
without the last condition (where Total=0) you have the status of all your servers that you can display in a dashboard also in graphic mode.

Bye.
Giuseppe

View solution in original post

gcusello
SplunkTrust
SplunkTrust

Hi cyberportnoc,

create a lookup with all your servers (e.g. perimeter.csv) calling column host and possibly using only uppercase (not mandatory)
run this search:

your search
| eval host=upper(host)
| stats count by host
| append [ | inputlookup perimeter.csv | eval host=upper(host), count=0 | fields host count ]
| stats sum(count) AS Total by host
| where Total = 0

In this way you listed all missing hosts.
without the last condition (where Total=0) you have the status of all your servers that you can display in a dashboard also in graphic mode.

Bye.
Giuseppe

Get Updates on the Splunk Community!

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...