Splunk Search

Edit data In Splunk

jokovitch
Explorer

I have a data in Splunk like

index="main"

FnameCountry
fname1USA
fname1USA
fname3USA

 

I want to add and change some data

where Fname="fname1"  I want to edit that Country = UK and add field of Phone =123

 

The final data will be

 

FnamePhone Country
fname1123UK
fname1123UK
fname3 USA

How can I do that?

Labels (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @jokovitch,

as @anilchaithu hinted, the correct search should be:

index=main
| eval Country=if(Fname="fname1","UK",Country), Phone=if(Fname="fname1","123","")
| table Fname Phone Country

if it doesn't run, check the fieldname (fields are case sensitive).

If doesn't run, please describe results and what's error.

Ciao.

Giuseppe

0 Karma

anilchaithu
Builder

@jokovitch 

you can use the below eval command for this task

eval Country = if(Fname="fname1", "UK", Fname), Phone= case(Fname="fname1", "123")

 

-- Hope this helps

0 Karma

jokovitch
Explorer
index="main" |eval Phone= case(Fname="fname1", "123")

I have tried this command , but nothing changed

0 Karma

anilchaithu
Builder

@jokovitch 

 

strange, try this. 

index="main" | eval Phone= case(like(Fname, "%fname1%", "123")

 

-- Hope this helps

0 Karma

jokovitch
Explorer

You need to change

 

index="main" | eval Phone= case(like(Fname, "%fname1%", "123")

 

to

 

index="main" | eval Phone= case(like(Fname, "%fname1%"), "123")

 

 

That still not change the data

 

Do I need to put this query in another place then New Search screen ? Or maybe is there place that I need to mark to commit this data?

 

 

0 Karma

jokovitch
Explorer

Do you have any idea how to fix that ?

0 Karma
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...