XML Parser

LogViewPlus has a built in XML parser which is capable of analyzing your custom XML log files. It does this by parsing your XML file according to a template. A template is a sample XML log entry that has certain fields identified with Conversion Specifiers.

Let's look at a simple XML example:

<xml>

<name firstName="John" lastName="Doe" />

<employeeId>12345</employeeId>

<other attr1="ignore">ignore</other>

<dateJoined>2014-05-16 10:50:14,125</dateJoined>

</xml>

This is a XML log entry with five fields: firstName, lastName, employeedId, other, and dateJoined. What we need to do is replace the field data with a Conversion Specifier that identifies the field data type. This might give us the following mapping.

XML Field
Conversion Specifier
LogViewPlus Column
firstName
%S{First Name}
First Name
lastName
%S{Last Name}
Last Name
employeeId
%s{Employee Id}
Employee Id
other
We want to ignore this field.
dateJoined
%d
Date and Time

Therefore, we could parse this XML log entry with the template:

<xml>

<name firstName="%S{First Name}" lastName="%S{Last Name}" />

<employeeId>%s{Employee Id}</employeeId>

<dateJoined>%d</dateJoined>

</xml>

Notice that in the above template the "other" field has been ignored. To ignore a field we simply do not include it in our template. If one of the elements we were interested in had been a child of a parent node, we would have needed to include the parent node in our template. The important thing is that the template has the full path to the target node.

Once we load this template into LogViewPlus it will appear as:

To do this, we just need to give LogViewPlus our parsing template as an argument for the XML parser. We can do this in Parser Mappings:

Note that whitespace will be ignored, so we can go ahead and format the XML as needed.

Finally, notice the similarities between the XML Parser and the JSON Parser. Both use the concept of templates, so once you have learned one you have basically learned the other.

< >