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!

Announcing Scheduled Export GA for Dashboard Studio

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

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...