spath command: Overview, syntax, and usage
The SPL2 spath command extracts information from the XML and JSON structured data formats.
The SPL2 spath command extracts information from the XML and JSON structured data formats.
Use these links to quickly navigate to the main sections in this topic:
Syntax
The required syntax is in bold.
spath
[input=field]
[output=field]
[path="path"]
Required parameters
path
Syntax: "path"
Description: The location path to the value that you want to extract, expressed in dot ( . ) notation. The path must be enclosed in quotation marks.
A location path is composed of one or more location steps, separated by periods. An example of this is 'emea.europe.pl'. A location step is composed of a field name and an optional index surrounded by curly brackets. The index can be an integer, to refer to the position of the data in an array (this differs between JSON and XML), or a string, to refer to an XML attribute. If the index refers to an XML attribute, specify the attribute name with an @ symbol.
Optional parameters
input
Syntax: field
Description: The field to read in and extract values from.
Default: _raw
output
Syntax: field
Description: The value extracted from the path is written to this field name.
Default: The value for the path becomes the field name for the extracted value.
Usage
The following sections contain information to help you understand and use the SPL2 spath command.
Differences between SPL and SPL2
The SPL2 spath command requires the path argument. This argument is not required for the SPL spath command.
See also
spath command