Splunk Search

Why is the map command in my search no longer returning results?

kallisrayar1986
Path Finder

Hi,

I would like to get the values of an event that matches a median value of that event. My search is something like this:

index = "index" test_id = "test_id" Scenario = "scenario" | stats median(field) as "SomeName" | map [search index = "index" test_id = "test_id" Scenario = "scenario" AND field = $SomeName$ | stats values by test_id ]

it used to work before, but for some reason it is not now. Please help.

0 Karma
1 Solution

sundareshr
Legend

You may be able to get your results using just a subsearch, like this

index = "index" test_id = "test_id" Scenario = "scenario"  [search index = "index" test_id = "test_id" Scenario = "scenario" | stats median(field) as field]   | stats values by test_id 

OR avoid the sub-search with this

index = "index" test_id = "test_id" Scenario = "scenario"  | eventstats median(field) as med | where field=med | stats values by test_id

View solution in original post

0 Karma

sundareshr
Legend

You may be able to get your results using just a subsearch, like this

index = "index" test_id = "test_id" Scenario = "scenario"  [search index = "index" test_id = "test_id" Scenario = "scenario" | stats median(field) as field]   | stats values by test_id 

OR avoid the sub-search with this

index = "index" test_id = "test_id" Scenario = "scenario"  | eventstats median(field) as med | where field=med | stats values by test_id
0 Karma

kallisrayar1986
Path Finder

thank you Sundareshr, it worked.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...