Splunk Search

How to use field name as the value passed into a lookup table?

TobiasBoone
Communicator
| foreach p* [eval val='<>' | lookup wkst_risk_control asset_risk_position AS 'val']

I have 19 separate p extraction fields called p0-p18. I am looking to loop through each of the field names called p* and do a lookup of the name of the field itself from the lookup table wkst_risk_control to get the supplemental data. I am struggling and missing something. Is foreach the best way or is there a more elegant method?

0 Karma

somesoni2
Revered Legend

Something like this should work

...| foreach p* [ lookup wkst_risk_control asset_risk_position AS "<<FIELD>>"]
0 Karma
Get Updates on the Splunk Community!

Aligning Observability Costs with Business Value: Practical Strategies

 Join us for an engaging Tech Talk on Aligning Observability Costs with Business Value: Practical ...

Mastering Data Pipelines: Unlocking Value with Splunk

 In today's AI-driven world, organizations must balance the challenges of managing the explosion of data with ...

Splunk Up Your Game: Why It's Time to Embrace Python 3.9+ and OpenSSL 3.0

Did you know that for Splunk Enterprise 9.4, Python 3.9 is the default interpreter? This shift is not just a ...