Returns a paginated logs list.
Only admins can perform this action.
import PocketBase from 'pocketbase';
const pb = new PocketBase('http://127.0.0.1:8090');
...
await pb.admins.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.admins.authWithPassword('test@example.com', '1234567890');
final pageResult = await pb.logs.getList(
page: 1,
perPage: 20,
filter: 'data.status >= 400',
);
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, eg.: ?filter=(data.url~'test.com' && level>0)
Supported log filter fields: The syntax basically follows the format
To group and combine several expressions you could 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": "9ajmzgd99r039k9",
"created": "2023-12-12 04:41:59.973Z",
"updated": "2023-12-12 04:41:59.973Z",
"data": {
"auth": "authRecord",
"execTime": 364.961387,
"method": "POST",
"referer": "http://localhost:8090/",
"remoteIp": "127.0.0.1",
"status": 200,
"type": "request",
"url": "/api/collections/users/auth-with-password",
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36",
"userIp": "127.0.0.1"
},
"message": "POST /api/collections/users/auth-with-password",
"level": 0
},
{
"id": "26apis4s3sm9yqm",
"created": "2023-12-12 04:27:21.583Z",
"updated": "2023-12-12 04:27:21.583Z",
"data": {
"auth": "authRecord",
"execTime": 403.664712,
"method": "POST",
"referer": "http://localhost:8090/",
"remoteIp": "127.0.0.1",
"status": 200,
"type": "request",
"url": "/api/collections/users/auth-with-password?expand=rel&fields=*%2Crecord.*%2Crecord.expand.rel.id",
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36",
"userIp": "127.0.0.1"
},
"message": "POST /api/collections/users/auth-with-password?expand=rel&fields=*%2Crecord.*%2Crecord.expand.rel.id",
"level": 0
}
]
}
{
"code": 400,
"message": "Something went wrong while processing your request. Invalid filter.",
"data": {}
}
{
"code": 401,
"message": "The request requires admin authorization token to be set.",
"data": {}
}
{
"code": 403,
"message": "You are not allowed to perform this request.",
"data": {}
}
Returns a single log by its ID.
Only admins can perform this action.
import PocketBase from 'pocketbase';
const pb = new PocketBase('http://127.0.0.1:8090');
...
await pb.admins.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.admins.authWithEmail('test@example.com', '123456');
final log = await pb.logs.getOne('LOG_ID');
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": "twjnabervu5log8",
"created": "2023-12-10 19:56:29.556Z",
"updated": "2023-12-10 19:56:29.556Z",
"data": {
"auth": "guest",
"execTime": 0.66452,
"method": "GET",
"referer": "http://localhost:8090/",
"remoteIp": "127.0.0.1",
"status": 200,
"type": "request",
"url": "/api/collections/users/auth-methods",
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36",
"userIp": "127.0.0.1"
},
"message": "GET /api/collections/users/auth-methods",
"level": 0
}
{
"code": 401,
"message": "The request requires admin authorization token to be set.",
"data": {}
}
{
"code": 403,
"message": "You are not allowed to perform this request.",
"data": {}
}
{
"code": 404,
"message": "The requested resource wasn't found.",
"data": {}
}
Returns hourly aggregated logs statistics.
Only admins can perform this action.
import PocketBase from 'pocketbase';
const pb = new PocketBase('http://127.0.0.1:8090');
...
await pb.admins.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.admins.authWithPassword('test@example.com', '123456');
final stats = await pb.logs.getStats(
filter: 'data.status >= 400'
);
Authorization: TOKEN
Param | Type | Description |
---|---|---|
filter | String | Filter expression to filter/search the logs, eg.: ?filter=(data.url~'test.com' && level>0)
Supported log filter fields: The syntax basically follows the format
To group and combine several expressions you could 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 admin authorization token to be set.",
"data": {}
}
{
"code": 403,
"message": "You are not allowed to perform this request.",
"data": {}
}