Splunk Search

Rest search with input from inputlook

jariw
Path Finder

Hi,

I'm bouncing my head against the wall for this (probably) simple question..

 

I've got a inputlookup "indexers". As the name says.. those are the splunk indexers, but will be more than that in the future. I want to get disc sizes off them with the below serach

|inputlookup indexers | fields host | stats count by host |map search="search (| rest splunk_server=$host$ /services/server/status/partitions-space]")

It all goes well until the map command. The stats gives a nice list off the servers. It goes wrong at the "search (| rest splunk_server=$host$ /services/server/status/partitions-space]"   part.

When i try this part off the search.. it strips the | from the search.. and gives nothing. It seems a search command followed with a | will strip the | .. and then de rest search is useless.

What can i do to pass the hostnames from the inputlookup to the |rest search?

 

Thanx in advance

 

grts

Jari

 

 

 

 

Labels (1)
0 Karma
1 Solution

manjunathmeti
SplunkTrust
SplunkTrust

Hi Jari,

You don't need to run sub-search for each host. Run rest command first, append lookup results, and use stats to merge.

| rest /services/server/status/partitions-space 
| append 
    [| inputlookup indexers 
    | fields host 
    | stats count by host 
    | eval splunk_server=host] 
| stats max(*) as * by splunk_server 
| where host="*"

 

| where host="*" gives results only for hosts in the lookup file.

If this reply helps you, an upvote/like would be appreciated.

View solution in original post

0 Karma

jariw
Path Finder

Yes.. That's it. Didn't think about changing the order. Thanx again 👍

0 Karma

manjunathmeti
SplunkTrust
SplunkTrust

please accept and upvote answer if it is working.

0 Karma

manjunathmeti
SplunkTrust
SplunkTrust

Hi Jari,

You don't need to run sub-search for each host. Run rest command first, append lookup results, and use stats to merge.

| rest /services/server/status/partitions-space 
| append 
    [| inputlookup indexers 
    | fields host 
    | stats count by host 
    | eval splunk_server=host] 
| stats max(*) as * by splunk_server 
| where host="*"

 

| where host="*" gives results only for hosts in the lookup file.

If this reply helps you, an upvote/like would be appreciated.

0 Karma
Get Updates on the Splunk Community!

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

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...