Getting Data In

Data Filteration from Two Different Sourcetypes

shreyad
Explorer

How do I display data that must be filtered from attributes from 2 different sourcetypes? The search is a multisearch.

This is the query. I would like each of the 4 outputs to be furthered filtered by a "sourcetype2" with an attribute specific to sourcetype2.

|multisearch [search index = index sourcetype="sourcetype1" host=host [| tstats count WHERE index = index sourcetype="sourcetype1" host=host earliest=@mon
| eval earliest=if(count=0,"-1mon@mon","@mon") | table earliest ] ALL MY ATTRIBUTES | eval Coast ="1"] [search index = index sourcetype="sourcetype1" host=host [| tstats count WHERE index = index sourcetype="sourcetype1" host=host earliest=@mon
| eval earliest=if(count=0,"-1mon@mon","@mon") | table earliest ]ALL MY ATTRIBUTES | eval Coast ="2"] [search index = qualys sourcetype="sourcetype1" host=host [| tstats count WHERE index = index = index sourcetype="sourcetype1" host=host earliest=@mon
| eval earliest=if(count=0,"-1mon@mon","@mon") | table earliest ] ALL MY ATTRIBUTES | eval Coast ="3"]
[search index = index sourcetype="sourcetype1" host=host [| tstats count WHERE index = index sourcetype="sourcetype1" host=host earliest=@mon
| eval earliest=if(count=0,"-1mon@mon","@mon") | table earliest ] ALL MY ATTRIBUTES | eval Coast ="4"] | dedup IP | stats count(IP) by Coast

0 Karma

sudosplunk
Motivator

As @jplumsdaine22 suggested, please provide more information for more accurate answers. Meanwhile, try something like this:

index=your_index sourcetype=first_sourcetype OR sourcetype=second_sourcetype fieldname=common_field_value

0 Karma

hortonew
Builder

I'd eval a new field for whether it should be displayed or not, with criteria from both. For instance: | eval shouldDisplay=case(sourcetype="sourcetype1" AND someField="y", "true", sourcetype="sourcetype2" AND someField="y", "true", 1==1, "false") | where shouldDisplay="true"

0 Karma

jplumsdaine22
Influencer

Hi, it would be helpful if you demonstrated the search you are currently running, and possibly some sample events and what you expect the output of your SPL to be

0 Karma

shreyad
Explorer

|multisearch [search index = index sourcetype="sourcetype1" host=host [| tstats count WHERE index = index sourcetype="sourcetype1" host=host earliest=@mon
| eval earliest=if(count=0,"-1mon@mon","@mon") | table earliest ] ALL MY ATTRIBUTES | eval Coast ="1"] [search index = index sourcetype="sourcetype1" host=host [| tstats count WHERE index = index sourcetype="sourcetype1" host=host earliest=@mon
| eval earliest=if(count=0,"-1mon@mon","@mon") | table earliest ]ALL MY ATTRIBUTES | eval Coast ="2"] [search index = qualys sourcetype="sourcetype1" host=host [| tstats count WHERE index = index = index sourcetype="sourcetype1" host=host earliest=@mon
| eval earliest=if(count=0,"-1mon@mon","@mon") | table earliest ] ALL MY ATTRIBUTES | eval Coast ="3"]
[search index = index sourcetype="sourcetype1" host=host [| tstats count WHERE index = index sourcetype="sourcetype1" host=host earliest=@mon
| eval earliest=if(count=0,"-1mon@mon","@mon") | table earliest ] ALL MY ATTRIBUTES | eval Coast ="4"] | dedup IP | stats count(IP) by Coast

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...