Splunk Search

How to use replace in search?

kiran331
Builder

Hi

How to replace a character in a field value with another character? I have below field value, I have to replace @ with %40.

event_id:
32323ff-343443fg-43344g-34344-343434fdef@@notable@@33434fdf-3434gfgfg-ere343

I'm trying to get this

32323ff-343443fg-43344g-34344-343434fdef%40%40notable5%40%4033434fdf-3434gfgfg-ere343

0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Use the replace function like this:

... | eval event_ID=replace(event_id,"@","%40") | ...
---
If this reply helps you, Karma would be appreciated.

View solution in original post

Dawson014
Path Finder

Unrelated to this query, but for special characters like period (.) use the escape character -"\".
Like - ... | eval name = replace("lastname.firstname","\.",",") | ...

richgalloway
SplunkTrust
SplunkTrust

Use the replace function like this:

... | eval event_ID=replace(event_id,"@","%40") | ...
---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...