Returns a paginated logs list.
Only superusers can perform this action.
import PocketBase from 'pocketbase';
const pb = new PocketBase('http://127.0.0.1:8090');
...
await pb.collection("_superusers").authWithPassword('test@example.com', '1234567890');
const pageResult = await pb.logs.getList(1, 20, {
filter: 'data.status >= 400'
});
import 'package:pocketbase/pocketbase.dart';
final pb = PocketBase('http://127.0.0.1:8090');
...
await pb.collection("_superusers").authWithPassword('test@example.com', '1234567890');
final pageResult = await pb.logs.getList(
page: 1,
perPage: 20,
filter: 'data.status >= 400',
);
API details
Authorization:TOKEN
Param | Type | Description |
---|---|---|
page | Number | The page (aka. offset) of the paginated list (default to 1). |
perPage | Number | The max returned logs per page (default to 30). |
sort | String | Specify the ORDER BY fields. Add // DESC by the insertion rowid and ASC by level
?sort=-rowid,level Supported log sort fields: |
filter | String | Filter expression to filter/search the returned logs list, e.g.: ?filter=(data.url~'test.com' && level>0) Supported log filter fields: The syntax basically follows the format
To group and combine several expressions you can use parenthesis
Single line comments are also supported: |
fields | String | Comma separated string of the fields to return in the JSON response (by default returns all fields). Ex.: ?fields=*,expand.relField.name
In addition, the following field modifiers are also supported:
|
{
"page": 1,
"perPage": 20,
"totalItems": 2,
"items": [
{
"id": "ai5z3aoed6809au",
"created": "2024-10-27 09:28:19.524Z",
"data": {
"auth": "_superusers",
"execTime": 2.392327,
"method": "GET",
"referer": "http://localhost:8090/_/",
"remoteIP": "127.0.0.1",
"status": 200,
"type": "request",
"url": "/api/collections/_pbc_2287844090/records?page=1&perPage=1&filter=&fields=id",
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36",
"userIP": "127.0.0.1"
},
"message": "GET /api/collections/_pbc_2287844090/records?page=1&perPage=1&filter=&fields=id",
"level": 0
},
{
"id": "26apis4s3sm9yqm",
"created": "2024-10-27 09:28:19.524Z",
"data": {
"auth": "_superusers",
"execTime": 2.392327,
"method": "GET",
"referer": "http://localhost:8090/_/",
"remoteIP": "127.0.0.1",
"status": 200,
"type": "request",
"url": "/api/collections/_pbc_2287844090/records?page=1&perPage=1&filter=&fields=id",
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36",
"userIP": "127.0.0.1"
},
"message": "GET /api/collections/_pbc_2287844090/records?page=1&perPage=1&filter=&fields=id",
"level": 0
}
]
}
{
"code": 400,
"message": "Something went wrong while processing your request. Invalid filter.",
"data": {}
}
{
"code": 401,
"message": "The request requires valid record authorization token.",
"data": {}
}
{
"code": 403,
"message": "The authorized record is not allowed to perform this action.",
"data": {}
}
Returns a single log by its ID.
Only superusers can perform this action.
import PocketBase from 'pocketbase';
const pb = new PocketBase('http://127.0.0.1:8090');
...
await pb.collection("_superusers").authWithEmail('test@example.com', '123456');
const log = await pb.logs.getOne('LOG_ID');
import 'package:pocketbase/pocketbase.dart';
final pb = PocketBase('http://127.0.0.1:8090');
...
await pb.collection("_superusers").authWithEmail('test@example.com', '123456');
final log = await pb.logs.getOne('LOG_ID');
API details
id
Authorization:TOKEN
Param | Type | Description |
---|---|---|
id | String | ID of the log to view. |
Param | Type | Description |
---|---|---|
fields | String | Comma separated string of the fields to return in the JSON response (by default returns all fields). Ex.: ?fields=*,expand.relField.name
In addition, the following field modifiers are also supported:
|
{
"id": "ai5z3aoed6809au",
"created": "2024-10-27 09:28:19.524Z",
"data": {
"auth": "_superusers",
"execTime": 2.392327,
"method": "GET",
"referer": "http://localhost:8090/_/",
"remoteIP": "127.0.0.1",
"status": 200,
"type": "request",
"url": "/api/collections/_pbc_2287844090/records?page=1&perPage=1&filter=&fields=id",
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36",
"userIP": "127.0.0.1"
},
"message": "GET /api/collections/_pbc_2287844090/records?page=1&perPage=1&filter=&fields=id",
"level": 0
}
{
"code": 401,
"message": "The request requires valid record authorization token.",
"data": {}
}
{
"code": 403,
"message": "The authorized record is not allowed to perform this action.",
"data": {}
}
{
"code": 404,
"message": "The requested resource wasn't found.",
"data": {}
}
Returns hourly aggregated logs statistics.
Only superusers can perform this action.
import PocketBase from 'pocketbase';
const pb = new PocketBase('http://127.0.0.1:8090');
...
await pb.collection("_superusers").authWithPassword('test@example.com', '123456');
const stats = await pb.logs.getStats({
filter: 'data.status >= 400'
});
import 'package:pocketbase/pocketbase.dart';
final pb = PocketBase('http://127.0.0.1:8090');
...
await pb.collection("_superusers").authWithPassword('test@example.com', '123456');
final stats = await pb.logs.getStats(
filter: 'data.status >= 400'
);
API details
Authorization:TOKEN
Param | Type | Description |
---|---|---|
filter | String | Filter expression to filter/search the logs, e.g.: ?filter=(data.url~'test.com' && level>0) Supported log filter fields: The syntax basically follows the format
To group and combine several expressions you can use parenthesis
Single line comments are also supported: |
fields | String | Comma separated string of the fields to return in the JSON response (by default returns all fields). Ex.: ?fields=*,expand.relField.name
In addition, the following field modifiers are also supported:
|
[
{
"total": 4,
"date": "2022-06-01 19:00:00.000"
},
{
"total": 1,
"date": "2022-06-02 12:00:00.000"
},
{
"total": 8,
"date": "2022-06-02 13:00:00.000"
}
]
{
"code": 400,
"message": "Something went wrong while processing your request. Invalid filter.",
"data": {}
}
{
"code": 401,
"message": "The request requires valid record authorization token.",
"data": {}
}
{
"code": 403,
"message": "The authorized record is not allowed to perform this action.",
"data": {}
}