Splunk Search

How to remove \x22 from raw results.

jurjenterpstra
New Member

I'm trying to replace the "\x22" entries in my raw results with the correct quotation marks so I can read the the full result.

In the below example I can read correlation_id and request.timestamp as expected, but I can't read request.headers.method

I'm assuming that replacing those "\x22" entries will do the job.

I've tried ... | rex mode=sed "s/\x22/\"/" but that does not seem to work.

{"correlation_id":"f86eae16-f2e5-498a-b544-a77cfd2ca38d","response_time":"0.046","request":{"timestamp":"2017-10-25T11:23:58+00:00","method":"PATCH","path":"/ordermanagement/v1/orders/-41e6-5s7d0-8c77-228bfd2d6b0e/references","headers":{\x22host\x22:\x22api.example.com\x22,\x22X-Forwarded-Port\x22:\x22443\x22,\x22Content-Type\x22:\x22application\x5C/json; charset=utf-8\x22}}

Thanks for any help you can give!

Tags (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

The backslash in the regex string must be escaped. In an apparent quirk of Splunk regex, the escape character must also be escaped.
This worked for me.

... | rex mode=sed "s/\\\x22/\"/g" | ...
---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

The backslash in the regex string must be escaped. In an apparent quirk of Splunk regex, the escape character must also be escaped.
This worked for me.

... | rex mode=sed "s/\\\x22/\"/g" | ...
---
If this reply helps you, Karma would be appreciated.

niketn
Legend

Or replace() function 🙂

|  eval _raw=replace(_raw,"\\\x22","")
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

jurjenterpstra
New Member

Thank you!

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

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

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...