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.