I have a query which essentially looks like this,
| makeresults count=1
| eval host="host1, host2, host3, host4, host5, host6"
| makemv tokenizer="([^,]+),?" host
| mvexpand host
| fields - _time
| join type=left host
[ search index=someIndex host IN (host1, host2, host3, host4, host5, host6)
| stats count as numEvents, first(field1) as field1Val, first(field2) as field2Value by host ]
As one can see I have to pass the list of hosts "host1, host2, host3, host4, host5, host6", once during "makeresults" and another time in the sub search. Is there any way to declare a variable for this list.
Is there a way to avoid this duplication. Sometimes this list of hosts can be really long. I want to send this query to a non-IT user who doesn't understand Splunk too well and was wondering if I can reduce the hassle for him.
Thanks,
Ashish
... View more