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
- Log in to your Site24x7 account.
- Download and install the Site24x7 Server monitoring agent (Windows | Linux).
- 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:
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.
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="http://logging.apache.org/log4j/2.0/events" 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.
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 |