Extensible Markup Language (XML)は、シンプルなテキストフォーマットの言語で、データの保存や整理に使用されます。いくつかのログはXML形式で記述されており、XMLタグはデータの特定に使用されます。Site24x7アプリケーションログで、Site24x7でXMLログを分析して、詳細な情報を取得できます。
ログの種類の追加方法の詳細はこちら
<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>
Site24x7で、次のサンプルパターンを定義して、XMLフォーマットログを分析します。
ログは各値ごとに項目分けされて、Site24x7にアップロードされます。
| 項目名 | 項目値 | 
| Task | System Backup(1) | 
| Time | 1596432857 | 
| Operation | Partition Full Backup | 
| ResultCode | 0 | 
| Detail | The operation has been completed successfully. | 
| Result | Success | 
次のようにノードコンテンツのパターンを定義して、サンプルログパターンで分析することもできます。
<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>
上記のサンプルログは2つの値dateとmessageに関連付いている<log>ノードを持っています。この情報は、次のログパターンを使用して取得できます。
このログは次の項目で分けられます。
| 項目名 | 項目値 | 
| 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 | 
次のように、rootやchild要素の属性を定義して、サンプルログパターンを表示できます。
<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>
いくつかの属性を定義して、次のようにrootとchild要素をログパターンに含められます。
| 項目名 | 項目値 | 
| 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 |