Logging API
The logging API lets an authorized client read the LRS activity logs and manage the log channels that decide where new log entries are dispatched. Authentication, value/field types, the shared query object and error responses are common to all TRAX APIs.
Contents: Logs · Log channels
Unlike the data API, the logging endpoints are not store-scoped — they live directly under the client path:
/trax/api/gateway/clients/{client}/...
Path segments:
{client}— your API client id.
Getting access
- Enable the API. This API is gated by the
LOGGING_APIfeature toggle (Settings → App). When off, the machine-token API is unavailable (the console UI is unaffected). - Client permission. The calling client must have the
logging/allpermission enabled (Clients → edit → Permissions). Authentication is HTTP Basic — see Authentication. - Base path. Copy your client's
endpoint(…/clients/{client}) from the Clients page (the ⓘ info button) and appendlogsorlog-channels.
Logs
The stored log records: xAPI/HTTP/console/stream/auth events and uncaught exceptions, each with a severity level and a functional context.
GET /trax/api/gateway/clients/{client}/logs
This is a filter-list read. Pass the query object as query-string
parameters (JSON-encoding filters and options) — use sort / limit / skip / after / before
there for ordering and pagination. filters accepts only the whitelisted keys below; any other key is
rejected (400).
Filters
| Name | Type | Description |
|---|---|---|
types |
stringified array | Keep only these log types. JSON-encoded array of strings, e.g. ["xapi","console"]. Known types: xapi, ui, console, stream, auth, exception. |
levels |
stringified array | Keep only these exact severity levels. JSON-encoded array of integers 0–7, e.g. [4,5]. See the level table below. |
min_level |
integer (0–7) |
Keep entries at this level or higher. Example: 4 (Error and above). |
store |
string | Keep only entries recorded for this store id. Example: default |
Severity levels (level column / levels / min_level values):
| Value | Name |
|---|---|
0 |
Debug |
1 |
Info |
2 |
Notice |
3 |
Warning |
4 |
Error |
5 |
Critical |
6 |
Alert |
7 |
Emergency |
Example response
{
"data": [
{
"id": 1842,
"type": "xapi",
"level": 4,
"event": "failed",
"description": "Bad Request",
"data": { "version": "1.0.3" },
"service": "xapi",
"api": "statement",
"method": "POST",
"store": "default",
"client": "app",
"stored": "2024-06-01T09:00:00.363058Z"
}
]
}
Response fields
| Field | Type | Description |
|---|---|---|
id |
integer | Auto-increment log row id. |
type |
string | Log type: xapi, ui, console, stream, auth, or exception. |
level |
integer (0–7) |
Severity level (see the level table above). |
event |
string | The event within the type, e.g. passed, failed, started, logged_in, authentication_failed. |
description |
string | null | Human-readable message. |
data |
object | Type-specific context (e.g. exception, settings, feedback, xAPI version). |
service |
string | null | Service that produced the entry. |
api |
string | null | API entry point. |
method |
string | null | HTTP method (or console/stream context). |
store |
string | null | Store id the entry relates to. |
client |
string | null | Client id the entry relates to. |
stored |
ISO-8601 date-time | When the entry was recorded (UTC, microsecond precision). |
Log channels
The configured log channels — each pairs a Laravel/Monolog channel type with the log types and
minimum severity it should receive. This is a full CRUD resource.
List channels
GET /trax/api/gateway/clients/{client}/log-channels
Returns all channels as { "data": [ /* channels */ ] }.
Find a channel
GET /trax/api/gateway/clients/{client}/log-channels/{channel}
{channel} is the channel id. Returns { "data": { /* channel */ } }, or 404 if unknown.
Create a channel
POST /trax/api/gateway/clients/{client}/log-channels
Update a channel
PUT /trax/api/gateway/clients/{client}/log-channels/{channel}
Body (create and update share the same rules)
| Name | Type | Description |
|---|---|---|
type |
enum (required) | The channel driver. One of database, single, daily, slack, papertrail, syslog, errorlog, stderr. |
log_types |
array | The log types this channel receives, e.g. ["xapi","exception"]. Optional; omit / null for all types. |
min_level |
integer (0–7) (required) |
Minimum severity the channel receives (see the level table under Logs). |
A 422 is returned when a value fails validation (e.g. an unknown type or an out-of-range
min_level). Both create and update return { "data": { /* channel */ } } with 200.
Example response
{
"data": {
"id": 3,
"type": "daily",
"log_types": ["xapi", "exception"],
"min_level": 4,
"created_at": "2024-06-01T09:00:00.000000Z",
"updated_at": "2024-06-01T09:00:00.000000Z"
}
}
Response fields
| Field | Type | Description |
|---|---|---|
id |
integer | Auto-increment channel id. |
type |
string | The channel driver (database, single, daily, slack, papertrail, syslog, errorlog, stderr). |
log_types |
array | The log types the channel receives. |
min_level |
integer (0–7) |
Minimum severity the channel receives. |
created_at |
ISO-8601 date-time | Row creation timestamp. |
updated_at |
ISO-8601 date-time | Row update timestamp. |
Delete a channel
DELETE /trax/api/gateway/clients/{client}/log-channels/{channel}
Removes the channel. Returns 204 with an empty body.
Clear all channels
DELETE /trax/api/gateway/clients/{client}/log-channels
Removes all channels. Returns 204 with an empty body.