Splunk Search

Overwriting input field in lookup

izzy
Engager

I have a question regarding lookup tables. I want to create a lookup that places the output in the same field as the input.

Let's say I have the following lookup table defined:
num,name
80,http
25,smtp

And the search returns a field named src_port with a value of 80.

I want a search that replaces the content of src_port with http. If the lookup doesn't produce any results then the original contents should remain.

This is what I've tried but it doesn't work. The result is that the field src_port is not available at all. | lookup convert-portnum num AS src_port OUTPUT name AS src_port

However, the same search using a different output field produces the expected result. | lookup convert-portnum num AS src_port OUTPUT name AS src_port_name

Has anyone gotten something like this to work?

Thanks

Tags (1)

niemesrw
Path Finder

Not sure when it was introduced, but you can now overwrite with a lookup:

http://docs.splunk.com/Documentation/Splunk/6.5.1/SearchReference/Lookup

0 Karma

gkanapathy
Splunk Employee
Splunk Employee

It is not possible to do this. You can rename or eval the field after the lookup instead.

izzy
Engager

oh well, it would have been nice
thanks for the reply

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...