Loading TOC...

xdmp:logmessage-parse

xdmp:logmessage-parse(
   $messages as xs:string*,
   $format as xs:string?,
   $time-zone-offset as xs:duration?
) as map:map*

Summary

Parse messages from logfile to xml, json, raw, or complex (XML with more elements) format.

Parameters
$messages The data from logfile.
$format Output format - xml (default), json, raw, complex.
$time-zone-offset Time Zone Offset, optional, not for raw format.

Required Privileges

http://marklogic.com/xdmp/privileges/xdmp-filesystem-file

Example

xdmp:logmessage-parse(
  xdmp:logfile-scan("file:///var/opt/MarkLogic/Logs/ErrorLog.txt", (), (), (), (), 3)
  , "xml", xs:dayTimeDuration("PT6H"))
=>
<log timestamp="2021-09-09T15:54:45.293+06:00" level="notice" xmlns="http://marklogic.com/xdmp/telemetry">Starting MarkLogic Server 10.0-20210904 x86_64 in /opt/MarkLogic with data in /var/opt/MarkLogic</log>
<log timestamp="2021-09-09T15:54:45.296+06:00" level="info" xmlns="http://marklogic.com/xdmp/telemetry">MarkLogic Converters 10.0-20210825 found</log>
<log timestamp="2021-09-09T15:54:45.485+06:00" level="info" xmlns="http://marklogic.com/xdmp/telemetry">Host host-in-cluster with 32GB memory running Linux 5.7.15-100.fc31.x86_64 (Fedora release 31 (Thirty One))</log>

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.