Core
PaaS v2.x
2

Browser logs #

The Kuzzle PaaS web console sends its own logs and errors to the backend, which writes them with the backend logs (under the browser namespace). This controller exists for the web console; it is not meant to be called by integrations.

Controller: browser-logs

Push a batch of logs #

Writes a batch of log entries in the payload format of kuzzle-logger/browser (version 1). Each entry is validated, sanitized and enriched (user, user agent, origin) before being written. Entries whose namespace is not one of the web console's own (web, web:global, web:vue) are still written, under browser, with their namespace in clientNamespace.

The action is granted to anonymous users as well as authenticated ones, so that errors raised before login are logged too.

const result = await kuzzle.query({
  controller: 'browser-logs',
  action: 'push',
  body: {
    version: 1,
    dropped: 0,
    entries: [
      // log entries produced by kuzzle-logger/browser
    ]
  }
});
// { accepted: 1, rejected: [] }

HTTP route:

POST /_/browser-logs/_push

Body properties:

  • version (required): payload version, 1.
  • entries (required): the log entries.
  • app (optional): information about the sending application.
  • dropped (optional): number of entries the client dropped before sending.

The response gives the number of accepted entries and, for each rejected one, its index in entries and the reason. An invalid batch is refused with a 400 error.