Getting Data In

Map with inputlookup not working

nsraoch1975
New Member

I have a dataset 1 like:
VID
A212
A213
B151
B153

Dataset 2 like:
QID Solution
2145 text contains A212
2155 text contains B151
2157 text contains A212
2855 text contains B151

Wanted output like:
VID QID Solution -> for all matching cases

I tried the following search for a single item search and it is working fine

|from inputlookup:"dataset1" |where like(vid,"%A212%")|stats values(vid) as vid
|map [|from inputlookup:"dataset2" |where like(Solution,"%".$vid$."%") |Table QID,Solution] 

But when the main search returns multiple values, it is not working - shows no results.

|from inputlookup:"dataset1" |where like(vid,"%A%")|stats values(vid) as vid
    |map [|from inputlookup:"dataset2" |where like(Solution,"%".$vid$."%") |Table QID,Solution] 

What am i doing wrong here ?

0 Karma
1 Solution

elliotproebstel
Champion

The map command will, by default, only take the first ten values. If you'd like it to look at more than ten, you need to use the maxsearches flag, like: | map maxsearches=100 [...]. You can also use maxsearches=0 to have no limit. However, I'd avoid using map for this, because you can restructure this to not use map at all, and doing so will launch a new search for every result from the base search - a very inefficient way to find what you're looking for. See if this restructured query will give you what you're looking for:

| inputlookup dataset2 where 
[ | inputlookup dataset1 where vid="*A212*"
   | eval vid="*".vid."*"
   | stats values(vid) AS vid 
   | format ]

This restructured query takes the values from dataset1, reformats them with wildcards, and uses them as a search filter for dataset2.

View solution in original post

0 Karma

elliotproebstel
Champion

The map command will, by default, only take the first ten values. If you'd like it to look at more than ten, you need to use the maxsearches flag, like: | map maxsearches=100 [...]. You can also use maxsearches=0 to have no limit. However, I'd avoid using map for this, because you can restructure this to not use map at all, and doing so will launch a new search for every result from the base search - a very inefficient way to find what you're looking for. See if this restructured query will give you what you're looking for:

| inputlookup dataset2 where 
[ | inputlookup dataset1 where vid="*A212*"
   | eval vid="*".vid."*"
   | stats values(vid) AS vid 
   | format ]

This restructured query takes the values from dataset1, reformats them with wildcards, and uses them as a search filter for dataset2.

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...