Splunk Search

Why isn't my replace command working in this search?

nisha_kapoor
Path Finder
index=test TransactionId="xxx-xxx-xxx"|  replace "000" with "" in Status| fields Status

I want to replace the first occurrence of "000" in status to blank.This is the command I wrote after referring to Splunk Documentation. However, the results don't show me the modified value of Status. Is there something missing in the command?

My end result should be the value of Status with "000" replaced.

Thanks for your help

0 Karma
1 Solution

sbbadri
Motivator

try this

index=test | eval TransactionId="xxx-xxx-xxx" | replace *000* with ** in Status

View solution in original post

sbbadri
Motivator

try this

index=test | eval TransactionId="xxx-xxx-xxx" | replace *000* with ** in Status

somesoni2
Revered Legend

Try like this

 index=test TransactionId="xxx-xxx-xxx"| eval Status=replace(Status,"^000(.+)","\1") | fields Status
0 Karma

cmerriman
Super Champion

try a regex command:

|rex field=Status mode=sed "s/000//g"
0 Karma
Get Updates on the Splunk Community!

Index This | What can you do to make 55,555 equal 500?

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

Say goodbye to manually analyzing phishing and malware threats with Splunk Attack ...

In today’s evolving threat landscape, we understand you’re constantly bombarded with phishing and malware ...

AppDynamics is now part of Splunk Ideas

Hello Splunkers, We have exciting news for you! AppDynamics has been added to the Splunk Ideas Portal. Which ...