Skip to content

Commit

Permalink
Prepare app for release
Browse files Browse the repository at this point in the history
  • Loading branch information
NullIsNot0 committed Dec 2, 2020
1 parent 0d41b1f commit 2755f01
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 0 deletions.
34 changes: 34 additions & 0 deletions xmlutils/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
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_b[2](http://splunkbase.splunk.com/wiki/2) = 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.
94 changes: 94 additions & 0 deletions xmlutils/app.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"schemaVersion": "2.0.0",
"info": {
"title": "xmlutils",
"id": {
"group": null,
"name": "xmlutils",
"version": "1.2.0"
},
"author": [
{
"name": "vbumgarner",
"email": null,
"company": null
}
],
"releaseDate": null,
"description": "XML utilities",
"classification": {
"intendedAudience": null,
"categories": [],
"developmentStatus": null
},
"commonInformationModels": null,
"license": {
"name": null,
"text": null,
"uri": null
},
"privacyPolicy": {
"name": null,
"text": null,
"uri": null
},
"releaseNotes": {
"name": null,
"text": null,
"uri": null
}
},
"dependencies": null,
"tasks": null,
"inputGroups": null,
"incompatibleApps": null,
"platformRequirements": null,
"supportedDeployments": [
"_standalone",
"_distributed"
],
"targetWorkloads": null
}
# The following sections can be customized and added to the manifest. For detailed information,
# see the documentation at http://dev.splunk.com/view/packaging-toolkit/SP-CAAAE9V
#
# Lists the app dependencies and version requirements
# "dependencies": {
# "<app-group>:<app-name>": {
# "version": "*",
# "package": "<source-package-name>",
# "optional": [true|false]
# }
# }
#
# Lists the inputs that belong on the search head rather than forwarders
# "tasks": []
#
# Lists the possible input groups with app dependencies, and inputs that should be included
# "inputGroups": {
# "<group-name>": {
# "requires": {
# "<app-group>:<app-name>": ["<dependent-input-groups>"]
# },
# "inputs": ["<defined-inputs>"]
# }
# }
#
# Lists the app IDs that cannot be installed on the system alongside this app
# "incompatibleApps": {
# "<app-group>:<app-name>": "<version>"
# }
#
# Specify the platform version requirements for this app
# "platformRequirements": {
# "splunk": {
# "Enterprise": "<version>"
# }
# }
#
# Lists the supported deployment types this app can be installed on
# "supportedDeployments": ["*" | "_standalone" | "_distributed" | "_search_head_clustering"]
#
# Lists the targets where app can be installed to
# "targetWorkloads": ["*" | "_search_heads" | "_indexers" | "_forwarders"]
#
4 changes: 4 additions & 0 deletions xmlutils/default/commands.conf
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
[xmlkvrecursive]
python.version = python3
filename = xmlkvrecursive.py
retainsevents = true
overrides_timeorder = false
streaming = true

[xmlsplit]
python.version = python3
filename = xmlsplit.py
retainsevents = true
overrides_timeorder = false
run_in_preview = false
streaming = true

[xmlprettyprint]
python.version = python3
filename = xmlprettyprint.py
retainsevents = true
overrides_timeorder = false
run_in_preview = false
streaming = true

[xmlstripdeclaration]
python.version = python3
filename = xmlstripdeclaration.py
retainsevents = true
overrides_timeorder = false
Expand Down

0 comments on commit 2755f01

Please sign in to comment.