Splunk Search

assign value from subsearch to outer search eval

joydeep741
Path Finder

I want to get a value from subsearch assigned to outer search.

I am trying like this
index=OUTER sourcetype=OUTER_ST | eval value = [search index=INNER sourcetype=INNER_ST |eval x=10 |return $x ]

But this gives me
Error in 'eval' command: Failed to parse the provided arguments. Usage: eval dest_key = expression

How to resolve this ?

Tags (2)
0 Karma

HiroshiSatoh
Champion

Because the return value is a string, you can not do it?
How about this?

 index=OUTER sourcetype=OUTER_ST | eval value = [search index=INNER sourcetype=INNER_ST |eval x="\"10\"" |return $x ]
0 Karma

joydeep741
Path Finder

does it matter if the inner search is searching a different index than outer search ?

I am still getting
Error in 'eval' command: Failed to parse the provided arguments. Usage: eval dest_key = expression

0 Karma

HiroshiSatoh
Champion

If the value is numeric, it behaves like a sample.
This error is simply because the sub search result is 0.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...