Splunk Search

rex mode=sed syntax

cschafer1
New Member

I apolagize for the simplicity of this question. I have scowered all over splunk answers and could find or make sense of a solutions from what I have found.

I need to remove %20 from my search and replace with a space. I have tried:

rex mode=sed "s/%20/ /"
rex mode=sed "s/%20/ /g"
rex mode=sed field=fieldname "s/%20/ /g"

I am sure it is not registering with me whith the slashes what is needed in the sed sytax.

Thank you for any assistance.

Cory

Tags (1)
0 Karma
1 Solution

Ayn
Legend

That's really how you would do it with rex mode=sed so I really don't know why it's not working for you. However I suggest an alternate solution that seems more appropriate in your scenario anyway: use eval's urldecode function instead. It will read a string, decode all URL encoded entities and return the decoded string.

... | eval yourfield=urldecode(yourfield)

View solution in original post

Ayn
Legend

That's really how you would do it with rex mode=sed so I really don't know why it's not working for you. However I suggest an alternate solution that seems more appropriate in your scenario anyway: use eval's urldecode function instead. It will read a string, decode all URL encoded entities and return the decoded string.

... | eval yourfield=urldecode(yourfield)

Ayn
Legend

Awesome. Could you please mark my answer as accepted (click the tick mark on the left)? Thanks!

0 Karma

cschafer1
New Member

That worked... Thank you very much.

0 Karma
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 ...