Splunk Search

Why does the map command shows results only when the second query have value?

SathyaNarayanan
Path Finder

Hi Splunkers,

I have first query which produces 50 results, am using map command to run different query for each 50 results of first query and getting values, but when map command search query doesn't have any value from first query it ignores it.

Hence shows only 20 results but i was final output should be 50 results, if there is no value in second query it can be null.

Anyone have idea how to do it?

Thanks in advance.

0 Karma
1 Solution

HiroshiSatoh
Champion

If it does not exist, add it using a query on the MAP side.
For example, ...

(your search)
|map search="search (your search)|eval flg=1|append [|makeresults|eval flg=2]
     |eventstats count|where (count>1 AND flg=1) OR (count=1 AND flg=2) "

View solution in original post

0 Karma

HiroshiSatoh
Champion

If it does not exist, add it using a query on the MAP side.
For example, ...

(your search)
|map search="search (your search)|eval flg=1|append [|makeresults|eval flg=2]
     |eventstats count|where (count>1 AND flg=1) OR (count=1 AND flg=2) "
0 Karma

thwillmartin
Observer

It works for me too, except that I don't the the expected fields in my result. And I really can't tell you why it works. Please .... explain...

0 Karma

SathyaNarayanan
Path Finder

@HiroshiSatoh

Thank you, it works as expected

0 Karma
Get Updates on the Splunk Community!

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 ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...