Access Logs across a cluster

2019-06-24 19:18发布

问题:

I have a cluster with 3 nodes. I have Database with App Server configured.

I would like to know If the access logs generated are same across the hosts in a cluster

Or each host has a separate "Access log" that logs request to their hosts.

I know that Each host in a cluster maintains its own audit log files. Does it work the same way for Access logs.

Thanks, Karthik

回答1:

All MarkLogic Logs on a host only contain info about that host.

HTH!



回答2:

You can access files on all hosts in a cluster using any of the filesystem related xdmp functions such as xdmp:filesystem-file using the URI "file://host/file" where 'host' is the hostname as defined in that marklogic server, not always the same as the DNS hostname.

e.g.:

for $hid in xdmp:hosts()
let $h := xdmp:host-name($hid)
return 
xdmp:filesystem-file("file://" || $h || "/"||xdmp:data-directory($hid)||"/Logs/ErrorLog.txt")

Will return all ErrorLog.txt contents from all hosts in the cluster

In V9 there is a REST API for accessing logfiles across hosts in a cluster, including optimized searching based on time range and regex

See /manage/v2/logs

As with all REST API endpoints, the current implementation can be inferred by inspecting the source for the REST API included in the publicly available ML V9 distribution.