Dashboards & Visualizations

How can I dynamically set the path parameter to an spath command?

afleet
New Member

Hi - depending on a previously set value, I'd like to dynamically retrieve a different path in an spath command.

For instance:

| spath input=message path=salesOrderLineItems{} output=items1
| spath input=message path="salesOrderLineItems{}" output=items2
| eval pathDynamic="salesOrderLineItems{}"
| spath input=message path=pathDynamic output=items3
| table items1, items2, items3

items1 and items2 are populated with a json structure, but items3 returns as null

I'd be grateful if someone can confirm if/how this can be done.
Thanks.

0 Karma
Get Updates on the Splunk Community!

Improve Your Security Posture

Watch NowImprove Your Security PostureCustomers are at the center of everything we do at Splunk and security ...

Maximize the Value from Microsoft Defender with Splunk

 Watch NowJoin Splunk and Sens Consulting for this Security Edition Tech TalkWho should attend:  Security ...

This Week's Community Digest - Splunk Community Happenings [6.27.22]

Get the latest news and updates from the Splunk Community here! News From Splunk Answers ✍️ Splunk Answers is ...