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!

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...