I'm using the Website input app to scrape a page that's presented in XML. The issue is that the output contains backslashes which is not there when you load the web page in a browser. It looks like it's being put there to escape the quotes
Is there a way to remove the backslash?
Have you tried
SEDCMD-anyNameYouLike = s/\\"/"/g in your props.conf?
Have you tried
... | rex "s/\\"/"/g" in your search?
Unfortunately that regex doesn't work. Nor a modified one where I try to capture the backslash:
index=* |rex mode=sed "s/\\"/\"/g"
Doesn't remove the backslash.
OK. This works.
index=* | rex mode=sed "s/\\"/"/g"
Still giving backslashes in my 'Interesting Fields', but I'm closer to what I need now. Will work on the props.conf.
Because it's in XML, I'm having a hard time posting it here without it being interpreted. Once I click submit it removes all the tags...etc.
If you KNOW that ALL backslashes need to be removed, then you can easily remove them all. But that assumes that you want ALL the backslashes removed. If there are instances of backslashes which you want to keep, then you have to plan for that.
Removing backslashes only from before a quote might be what you want, but what if you have \"? Please provide some additional information about exactly what you need removed (and possibly why). That way he answer you get can be correct, and not "correct if and only if."
Resolved it. Thanks jkat54 and others for pointing me in the right direction.
Updated the props.conf file with:
[source::web_input://TestNode1] SEDCMD-RemovingBackSlash = s/\\//g
NOTE: if you try to do this in SPL. You need 3 backslashes. It's a known thing apparently e.g.: https://answers.splunk.com/answers/24026/sedcmd-special-requirement-for-backslash.html