Marklogic Audit Log

北城余情 提交于 2019-12-08 04:23:50

问题


I would see the below sample audit logging which MarkLogic provides

Sample logging : 2012-03-26 10:55:53.735 event=amp-usage; 
function=http://marklogic.com/xdmp/admin:read-config-file;
uri=/MarkLogic/admin.xqy; database=filesystem;
success=true; user=admin; roles=admin;

Can I customize this message by adding few more details highlighted below like this

Sample logging : 2012-03-26 10:55:53.735 event=amp-usage; function=http://marklogic.com/xdmp/admin:read-config-file; uri=/MarkLogic/admin.xqy; database=filesystem;success=true; user=admin; roles=admin; Received request for Tenant Id=xxxxx called by source id=xxxx Web. Request ID xxxx


回答1:


The purpose of audit logging is to be generated by MarkLogic, and not depend on the application, nor being influenced by it in any way. It should be an independent source to verify/audit the database activity.

I think Trace Event logging is what you are looking for. There are built-in Trace Events, like URL Rewrite:

http://docs.marklogic.com/guide/app-dev/appserver-control#id_25611

And you can use fn:trace to generate custom trace events. Make sure to activate trace events on the Diagnostics page of the appropriate group in the Admin interface, and to add on that same page all relevant trace events to the list of events that should get logged.

HTH!




回答2:


Of course, this can be achieved.

  1. Create a module (say activity-log.xqy) which creates and insert log document [xdmp:document-insert()] into audit database.

  2. Call it from another module (say, logger.xqy) which spawns the logging task [xdmp:spawn()], here you will specify the database name, so give audit in that.



来源:https://stackoverflow.com/questions/30249453/marklogic-audit-log

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!