Splunk Search

simple questions about a search

nebel
Communicator

hi there,

with the search...

`all_forwarders` | fields sourceHost 

...I will get all forwarder host names.
On the other hand I have a csv file which includes all servers. Now I want to create a diff between the csv file and the 'all forwarders' search.

At the moment I am using the following search to built a diff

inputlookup all_servers | search NOT [search `all_forwarders` | fields sourceHost]

The search is very not very efficient I think. Sometimes it gets totaly wrong results, sometimes it works fine...There a more than 8000 servers in the list...

Could you please help me to find more efficient search string?

Thank you very much in advance!

Regards

Tags (1)
0 Karma
1 Solution

lguinn2
Legend

Well, one problem is that your subsearch will return only 100 events; this is probably why you are not getting consistent results. I would do it this way

| inputlookup all_servers 
| fields sourceHost
| eval match_found=0
| join type=outer sourceHost
  [ search `all_forwarders`
    | eval match_found=1
    | fields sourceHost match_found 
    | format maxresults = 10000 ]
| where match_found = 0

I am not sure that this is more efficient, but it should at least be right.

View solution in original post

0 Karma

lguinn2
Legend

Well, one problem is that your subsearch will return only 100 events; this is probably why you are not getting consistent results. I would do it this way

| inputlookup all_servers 
| fields sourceHost
| eval match_found=0
| join type=outer sourceHost
  [ search `all_forwarders`
    | eval match_found=1
    | fields sourceHost match_found 
    | format maxresults = 10000 ]
| where match_found = 0

I am not sure that this is more efficient, but it should at least be right.

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...