Getting Data In

Transforming special characters in XML

jedatt01
Builder

I have an XML based source that has special characters defined. See below

&   &   
<   &lt;    
>   &gt;    
"   &quot;  
'   &apos;  

Does anyone know how to use transforms.conf to convert these to the real characters in the left column at index time?

Tags (2)
0 Karma

somesoni2
Revered Legend

Add this in your sourcetype definition (props.conf)

[yoursourcetype]
...
..other configs..
...
SEDCMD-specialchars1 = s/specialcodeInxml/replacementcode/g

You need to add one entry for each special character replacement.
e.g.

  for &
        SEDCMD-specialchars5 = s/&amp;/\&/g
  for others
        SEDCMD-specialchars3 = s/&quot;/"/g
        SEDCMD-specialchars4 = s/&apos;/'/g

For more details see this documentation-
http://docs.splunk.com/Documentation/Splunk/6.1.1/Data/Anonymizedatausingconfigurationfiles

search for "Anonymize data through a sed script"

Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...