Splunk Search

How to replace slash characters in field values with spaces instead (ex: change "A/B/C/D" to "A B C D")?

arnabsen1234
New Member

I have a field named httpUrl. This field has values with slashes like "/document/import/upload/reload/". I want to replace all the slashes with spaces. So the final thing should look like httpUrl="document import upload reload". How do I achieve this?

Tags (2)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Try ... | eval httpUrl=replace (httpUrl,"/"," ") | ...

---
If this reply helps you, Karma would be appreciated.

MuS
SplunkTrust
SplunkTrust

Hi arnabsen1234,

try something like this:

| gentimes start=-1 | eval httpUrl="document/import/upload/reload" | rex field=httpUrl mode=sed "s/\// /g"

cheers, MuS

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