All Apps and Add-ons

Splunk App for Unix and Linux: How can compare the 2 servers and get the unique ones from list one?

pradipto
Explorer

I have two lists of servers from two queries:

Search 1 ==>

| metadata type=hosts index=os| search host=srt* OR host=c1a* OR host=c2a*|table host|rename host as HostNames

Search 2 ==>

index="os" sourcetype="ps" host=srt* OR host=c1a* OR host=c2a* | eval processexists=if(match(_raw, "puppet"), 1, 0)  | search processexists=1 |dedup host|table host|rename host as PuppetClients

Now I want to find the servers that are there in Search 1 and not in Search 2.

0 Karma
1 Solution

493669
Super Champion

try this:

| metadata type=hosts index=os| search host=srt* OR host=c1a* OR host=c2a*|table host| search NOT[search index="os" sourcetype="ps" host=srt* OR host=c1a* OR host=c2a* | eval processexists=if(match(_raw, "puppet"), 1, 0) | search processexists=1 |dedup host|table host]

View solution in original post

0 Karma

493669
Super Champion

try this:

| metadata type=hosts index=os| search host=srt* OR host=c1a* OR host=c2a*|table host| search NOT[search index="os" sourcetype="ps" host=srt* OR host=c1a* OR host=c2a* | eval processexists=if(match(_raw, "puppet"), 1, 0) | search processexists=1 |dedup host|table host]
0 Karma

pradipto
Explorer

Works fine

0 Karma

493669
Super Champion

glad to help:) please upvote as well

0 Karma

493669
Super Champion

have you tried it?

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...