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
Example log for first pattern
Sample log
<Log><Time>2022-04-02T19:07:37.5111809-04:00</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 | 2022-04-02T19:07:37.5111809-04:00 |
Operation | Partition Full Backup |
ResultCode | 0 |
Detail | The operation has been completed successfully. |
Result | Success |

Example log for second pattern
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 |

Example log for third pattern
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.
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 |

Example log for fourth pattern
You can extract the attributes and content from the nodes and find a sample log pattern parsed by Site24x7 mentioned below:
Sample log
<Event><Timestamp type="4">2022-04-02T19:07:37.5111809-04:00</Timestamp><Service type="1">Dev</Service><Event type="1">Logging</Event></Event>
Log pattern
The sample log above contains nodes with both attributes and content, which can be extracted using the log pattern below.
xml $Service.type as Service_type:number$ $Service.content as Service_content$ $Event.type as Event_type:number$ $Event.content as Event_content$ $Timestamp.type as Timestamp_type:number$ $Timestamp.content as Timestamp_content:date:yyyy-MM-dd'T'HH:mm:ss.SSSX$
Field name | Field value |
Service_type | 1 |
Service_content | Dev |
Event_type | 1 |
Event_content | Logging |
Timestamp_type | 4 |
Timestamp_content | 2022-04-02T19:07:37.5111809-04:00 |
