Opensearch dashboards.auditor.add
Home > opensearch-dashboards > Auditor > add
Auditor.add() method
Add a record to audit log. Service attaches to a log record: - metadata about an end-user initiating an operation - scope name, if presents
Signature:
add(event: AuditableEvent): void;
Parameters
Parameter | Type | Description |
---|---|---|
event | AuditableEvent |
Returns:
void
Example
How to add a record in audit log:
router.get({ path: '/my_endpoint', validate: false }, async (context, request, response) => {
context.core.auditor.withAuditScope('my_plugin_operation');
const value = await context.core.opensearch.legacy.client.callAsCurrentUser('...');
context.core.add({ type: 'operation.type', message: 'perform an operation in ... endpoint' });