Help XML Logs

XML Logs

Extensible Markup Language (XML) is a simple text-based formatting language used to store and organize data. Some log frameworks write XML format logs, and an XML tag helps to identify the data. Site24x7 helps parse your XML logs and you can use Site24x7 AppLogs to derive more information.

Getting started

  1. Log in to your Site24x7 account.
  2. Download and install the Site24x7 Server monitoring agent (Windows | Linux).
  3. Go to Admin > AppLogs > Log Types, then select Add Log Type.

You can refer to this Adding a Log Type help document for more information.

XML format logs
Sample log

<Log><Time>1596432857</Time><Task>System Backup(1)</Task><Operation>Partition Full Backup</Operation><ResultCode>0</ResultCode><Result>Success</Result><Detail>The operation has been completed successfully.</Detail></Log>

Log pattern

The following is the sample pattern defined by Site24x7 to parse the XML formatted logs:

xml $Task$ $Time:date:unix$ $Operation$ $ResultCode:number$ $Detail$ $Result$

This log is separated into fields, each of which will take its respective value, and is then uploaded to Site24x7.

Field name Field value
Task System Backup(1)
Time 1596432857
Operation Partition Full Backup
ResultCode 0
Detail The operation has been completed successfully.
Result Success

You can also define a pattern for the node content and find a sample log pattern parsed by Site24x7 below:

Sample log

<root><container_id>2e7455cf85e0a1f3a1e49ca58b4833616775f221bbd2c2de03d87a76732d6d4e</container_id><container_name>/competent_robinson</container_name><source>stderr</source><log>2022/05/10 09:45:01 Server out Log Location Initialized to ./serverout.log</log></root>

Log pattern

The above sample log has a <log> node that has two associated values: date and message. This information can be derived using the log pattern below.

xml $container_name$ $log:pattern:$Date:date:yyyy/MM/dd HH:mm:ss$ $Message$$ $source$ $container_id$

This log is separated into the following fields:

Field name Field value
container_name /competent_robinson
Date 2022/05/10 09:45:01
Message Server out Log Location Initialized to ./serverout.log
source stderr
container_id 2e7455cf85e0a1f3a1e49ca58b4833616775f221bbd2c2de03d87a76732d6d4e

You can also define attributes for the root or child element and find a sample log pattern parsed by Site24x7 below:

Sample log

<Event xmlns="" thread="Main.main()" level="DEBUG" loggerName="Main" endOfBatch="false" loggerFqcn="org.apache.logging.log4j.spi.AbstractLogger" threadPriority="5" threadId="11"><Instant epochSecond="1657039904" nanoOfSecond="636000000"/><Message>Debug Message Logged !!!</Message></Event>

Log pattern

The following log pattern contains a root and child element with a few attributes defined.

xml $Instant.epochSecond as Date:date:unix$ $threadId:number$ $loggerFqcn$ $Message$ $level$ $endOfBatch$ $thread$ $loggerName$ $threadPriority:number$
Field name Field value
Date 1657039904
threadId 11
loggerFqcn org.apache.logging.log4j.spi.AbstractLogger
Message Debug Message Logged !!!
level DEBUG
endOfBatch false
thread Main.main()
loggerName Main
threadPriority 5

Related log types

JSON logs
Key-value logs

Was this document helpful?
Thanks for taking the time to share your feedback. We’ll use your feedback to improve our online help resources.

Help XML Logs