Splunk Search

How can I change the field values to another value ?

dbrancaglion
Explorer

Hello Guys!

I need to change the values that are present in the field "Item Codigo" .
alt text

For example:

040500603S007C10 to Product 01
010300404S014C01 to Product 02

I had searching the method, i tried use eval, but no success...

0 Karma

richgalloway
SplunkTrust
SplunkTrust

There are a couple of ways to do that. One is with eval.

... | eval "Item Codigo"  = case ("Item Codigo"=="040500603S007C10" , "Product 01", "Item Codigo"=="010300404S014C01", "Product 02", 1==1, 'Item Codigo')

The other is with a lookup table. First, create a CSV file (I call it "items.csv") with your item numbers and names. Like this:

ItemCodigo, ItemName
040500603S007C10, Product 01
010300404S014C01, Product 02

Then reference the lookup file in your query.

... | lookup items.csv ItemCodigo as "Item Codigo" | eval "Item Codigo" = ItemName
---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...