'Pretty Prints' an XML field. This can be an expensive operation and you should usually do this after filtering your data (at the end of your query) This will prevent data that will be filtered out from being formatted. If the field does not contain valid XML, the unmodified input value is stored in the output field. If no field is specified the @rawstring will be formatted.

ParameterTypeRequiredDefaultDescription
asstringoptional[a]  The name of the field to store the output in.
field[b]stringrequired@rawstring The name of the field to format.
stepintegeroptional[a]2 The indentation in number of characters.
strictbooleanoptional[a]false If set to true only valid XML input produce a value in the output field. By default invalid XML is copied to the output field unmodified.
widthintegeroptional[a]80 The width (in number of characters) to fit the output input.

[a] Optional parameters use their default value unless explicitly set

[b] The argument name field can be omitted.

Omitted Argument Names

The argument name for field can be omitted; the following forms of this function are equivalent:

logscale
xml:prettyPrint("@rawstring")

and:

logscale
xml:prettyPrint(field="@rawstring")

Format XML in the @rawstring field after filtering the data.

logscale
#type=SOAP
| account=123
| xml:prettyPrint()

Format XML in the field field payload to a max line length of 100 and indent by 4 spaces.

logscale
formattedXml := xml:prettyPrint(field=payload, step=4, width=100)

Only copy valid XML to the output field by setting strict=true. Here the field formattedXml will not be created for events with invalid XML in message.

logscale
formattedXml := xml:prettyPrint(field=message, strict=true)