Loading TOC...

alert.makeLogAction

alert.makeLogAction() as Object

Summary

Create a standard logging action named "log". Rules that reference this action must provide an directory property that specifies where the log file should be created. The inserted document will have a random long integer ID and its filename will be ID.json within the specified directory.

Rules that reference this action may also provide options with an permission property containing a series of permission properties and/or an collections object containing collection properties that specify the permissions and collections for the log document. This information is simply passed through to xdmp.documentInsert. An example of the rule's options is as follows:
    {"directory":"/some/directory",
     "permissions":[{"capability":"read","role-id":"129382323"}],   
     "collections":["http://acme.com/alert-log"]}
The log document insertion will be performed as the user who created the rule, and the user must have permission to create documents in any collections they specify. The log-id is a random number chosen by the action.

Example

  var alert = require("/MarkLogic/alert.xqy");

  alert.makeLogAction()
  

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