Logging API


Introduction

The Logging API covers 2 sub-APIs:

  • The Logs API which provides extended features to query the xAPI data
  • The Log Channels API which can be used to explore the xAPI vocabulary

Getting access to the API

The Logging API is enabled globally by default, and can be disabled with the LOGGING_API config option set to false.

It is fully accessible to all the clients which have the logging/all permission enabled.

The API endpoints rely on the base endpoint of each client. In this documentation, we will designate the base endpoint by <base-endpoint>. To get the base endpoint of a client:

  • Go to the Access > API Consumers > Clients page.
  • Click on the (i) icon of a client.
  • The endpoint is indicated next to the Base endpoint label.

Logs API

Getting the logs

Use the GET method on <base-endpoint>/logs with the following params:

Param Description
types Optional JSON encoded array of logs types, including exception, xapi, api, ui, console, auth, stream.
levels Optional JSON encoded array of levels, including 0 (debug), 1 (info), 2 (notice), 3 (warning), 4 (error), 5 (critical), 6 (alert), 7 (emergency).
min_level Required int. Return logs from this level and higher.
store Optional slug of a store.

Log Channels API

Creating a log channel

Use the POST method on <base-endpoint>/log-channels with the following JSON props:

Param Description
type Required string: database, single, daily, slack, papertrail, syslog, errorlog, stderr.
log_types Optional JSON encoded array of logs types, including exception, xapi, api, ui, console, auth, stream.
min_level Required int: 0 (debug), 1 (info), 2 (notice), 3 (warning), 4 (error), 5 (critical), 6 (alert), 7 (emergency).

Updating a log channel

Use the PUT method on <base-endpoint>/log-channels/<channel-id> with the same above content.

Getting the log channels

Use the GET method on <base-endpoint>/log-channels.

Getting a log channel

Use the GET method on <base-endpoint>/log-channels/<channel-id>.

Deleting the log channels

Use the DELETE method on <base-endpoint>/log-channels.

Deleting a log channel

Use the DELETE method on <base-endpoint>/log-channels/<channel-id>.