Splunk Search

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

| 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

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!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

(view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...