Dashboards & Visualizations

Is there a way to modify it to search for a host on Splunk instead of for the actual Splunk server?

sizemorejm
Explorer

I found this search query online, is there a way to modify it to search for a host on splunk instead of for the actual splunk server? 

| rest /services/server/info | eval LastStartupTime=strftime(startup_time, "%Y/%m/%d %H:%M:%S")
| eval timenow=now()
| eval daysup = round((timenow - startup_time) / 86400,0)
| eval Uptime = tostring(daysup) + " Days"
| table splunk_server LastStartupTime Uptime
Labels (2)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @sizemorejm ,

please try adding splunk_server=<your_host> to your search:

| rest /services/server/info splunk_server=<your_host>
| eval LastStartupTime=strftime(startup_time, "%Y/%m/%d %H:%M:%S")
| eval timenow=now()
| eval daysup = round((timenow - startup_time) / 86400,0)
| eval Uptime = tostring(daysup) + " Days"
| table splunk_server LastStartupTime Uptime

Ciao.

Giuseppe

0 Karma

sizemorejm
Explorer

doing splunk_server=host does not work. I get a no results found error

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @sizemorejm ,

as "host" you have to inserto the hostname of the Splunk server that you want to interrogate.

This is a correct approach as you cas see in this different answer https://community.splunk.com/t5/Getting-Data-In/Can-we-use-quot-rest-quot-to-call-Splunk-instances-o...

or in my screenshot:

gcusello_0-1690300510939.png

So check if you used the correct hostname.

Ciao.

Giuseppe

 

0 Karma

sizemorejm
Explorer

for some reason it doesnt recognize the individual servers only the main splunk server

 

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @sizemorejm ,

if you run a search no that server, what's the value of splunk_server field?

Ciao.

Giuseppe

0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

you could use only those servers which have defined as search peers to this search head. If you want to query other full splunk instances, usually you found those on MC (monitoring console).

r. Ismo

0 Karma

sizemorejm
Explorer

I just typed host as a placeholder name, I did use the actual server's host name and that is what is giving me the no results error.

0 Karma
Get Updates on the Splunk Community!

Monitoring Postgres with OpenTelemetry

Behind every business-critical application, you’ll find databases. These behind-the-scenes stores power ...

Mastering Synthetic Browser Testing: Pro Tips to Keep Your Web App Running Smoothly

To start, if you're new to synthetic monitoring, I recommend exploring this synthetic monitoring overview. In ...

Splunk Edge Processor | Popular Use Cases to Get Started with Edge Processor

Splunk Edge Processor offers more efficient, flexible data transformation – helping you reduce noise, control ...