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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...