Refine your search:

Thanks For Downloading!

Review the documentation below and follow any custom installation steps. If no install steps are listed, most Splunk Apps and Add-ons can be installed as follows:

Windows: Decompress the downloaded file using a tool like 7-Zip and place the resulting folder into %PROGRAMFILES%\Splunk\etc\apps. Then restart Splunk using the splunk restart command or the GUI.

Unix/Linux: Decompress the downloaded file using a tool like tar -xvf and place the resulting folder into $SPLUNK_HOME/etc/apps. Then restart Splunk using the splunk restart command or the GUI.

Description

A few utilities to help deal with indexed xml. xmlkvrecursive, xmlsplit, xmlprettyprint, xmlstripdeclaration

xmlutils provides a few commands for working with xml documents. xmlkv and xpath can accomplish most tasks, these are simply alternatives.

These commands will work on a field called "xml" if found, otherwise _raw.

xmlprettyprint

xmlprettyprint does what you would expect, pretty printing the xml.

xmlsplit

xmlsplit splits nodes into new events, copying other fields on the event to the new events.

Examples:

Given this xml:
<a><b>foo</b><b>bar</b></a>

xmlsplit field="b"
will create two events:
<b>foo</b>
<b>bar</b>

xmlkvrecursive

xmlkvrecursive recursively builds fields from the tag and attribute names. The optional boolean flatten determines how repeated fields are treated. By default, repeated field names will be appended into a multi-value field. With flatten="true", new fields will be created.

Examples:

sourcetype=* | head 1 | eval _raw="<a la='sdf'><b>foo</b><b>bar</b></a>" | xmlkvrecursive
produces:
a-la = sdf
a_b = [foo,bar]

sourcetype=* | head 1 | eval _raw="<a la='sdf'><b>foo</b><b>bar</b></a>" | xmlkvrecursive flatten=true
produces:
a-la = sdf
a_b = foo
a_b2 = bar

Most of the time, xpath or xmlkv would be more appropriate. This command is useful if you need to extract multiple fields that are not extracted easily using one of those commands.

xmlstripdeclaration

xmlstripdeclaration removes the <?xml declaration from the beginning of the xml. This is needed if the declaration is incorrect and the parser used by the other commands would refuse to continue.

Versions and Release Notes

Version 1.0 (current version - updated Dec 30, 2010)

posted 30 Dec '10, 17:29

vbumgarner's gravatar image

vbumgarner
1.8k210
accept rate: 23%

new version 30 Dec '10, 17:29

Be the first one to review!

Did you find this app useful?

Preview toggle preview

Details

This app is not covered by any support agreements in place with Splunk. If you have questions about the installation or operation of this app, please contact the author.

Version 1.0
Last Updated: Dec 30, 2010
Download Add-on
Author: vbumgarner
Version: 1.0
Splunk compatibility: 4.3, 4.2, 4.1, 4.x
Price: Free
License: Creative Commons BY 3.0
Downloads: 300

Follow this app

Log In to enable email subscriptions

RSS:

Reviews

Reviews + Comments

Copyright © 2005-2012 Splunk, Inc. All rights reserved.