kibana/x-pack/server/lib/audit_logger.js
Brandon Kobel f4f894a972
Introducing base audit logger (#19442)
* Adding very basic audit logging for auth success/failure

* Extracting security specific audit logger from the AuditLogger

* Using short auditLogger in authenticate in one more place

* Logging some information from the request during success/failure

* Adding AuditLogger tests

* Removing the security audit logger, this is out of scope...

* Better asserts, thanks Aleh

* Adding `audit` to the default events

* Using `info` with the audit logger, emulating with ES does
2018-05-30 08:26:09 -04:00

20 lines
541 B
JavaScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
export class AuditLogger {
constructor(server, pluginId) {
this._server = server;
this._pluginId = pluginId;
}
log(eventType, message, data = {}) {
this._server.log(['info', 'audit', this._pluginId, eventType], {
tmpl: message,
eventType,
...data
});
}
}