Returns a paginated request logs list.
Only admins can access 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.getRequestsList(1, 20, {
filter: 'status >= 400',
sort: '-created'
});
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.getRequestsList(
page: 1,
perPage: 20,
filter: 'status >= 400',
sort: '-created'
);
Authorization: TOKEN
Param | Type | Description |
---|---|---|
page | Number | The page (aka. offset) of the paginated list (default to 1). |
perPage | Number | The max returned request logs per page (default to 30). |
sort | String | Specify the ORDER BY fields. Add // DESC by the insertion rowid and ASC by status
?sort=-rowid,status
Supported request log sort fields: |
filter | String | Filter expression to filter/search the returned request logs list, eg.: ?filter=(url~'test.com' && created>'2022-01-01')
Supported request log filter fields: The syntax basically follows the format
To group and combine several expressions you could use parenthesis
|
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": 3,
"items": [
{
"id": "ox0A8SjBXcdoZC0",
"created": "2022-06-01 13:11:23.302Z",
"updated": "2022-06-01 13:11:23.302Z",
"url": "/api/users/auth-methods",
"method": "get",
"status": 200,
"auth": "guest",
"ip": "127.0.0.1:48272",
"referer": "http://127.0.0.1:8090/",
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36",
"meta": {}
},
{
"id": "elLzrW94D54Hxhj",
"created": "2022-06-01 13:10:03.374Z",
"updated": "2022-06-01 13:10:03.374Z",
"url": "/api/users/auth-methods",
"method": "get",
"status": 200,
"auth": "guest",
"remoteIp": "127.0.0.1:56134",
"userIp": "127.0.0.1:56134",
"referer": "http://127.0.0.1:8090/",
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36",
"meta": {}
},
{
"id": "WEiJHGnOnjS3see",
"created": "2022-06-01 13:09:43.429Z",
"updated": "2022-06-01 13:09:43.429Z",
"url": "/api/users/auth-methods",
"method": "get",
"status": 200,
"auth": "guest",
"remoteIp": "127.0.0.1:56134",
"userIp": "127.0.0.1:56134",
"referer": "http://127.0.0.1:8090/",
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36",
"meta": {}
}
]
}
{
"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 request log by its ID.
Only admins can access 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.getRequest('REQUEST_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.getRequest('REQUEST_ID');
id
Authorization: TOKEN
Param | Type | Description |
---|---|---|
id | String | ID of the Request 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": "WEiJHGnOnjS3see",
"created": "2022-06-01 13:09:43.429Z",
"updated": "2022-06-01 13:09:43.429Z",
"url": "/api/collections/users/auth-methods",
"method": "get",
"status": 200,
"auth": "guest",
"remoteIp": "127.0.0.1:56134",
"userIp": "127.0.0.1:56134",
"referer": "http://127.0.0.1:8090/",
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36",
"meta": {}
}
{
"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 request logs statistics.
Only admins can access 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.getRequestsStats({
filter: '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.getRequestsStats(
filter: 'status >= 400'
);
Authorization: TOKEN
Param | Type | Description |
---|---|---|
filter | String | Filter expression to filter/search the request logs, eg.: ?filter=(url~'test.com' && created>'2022-01-01')
Supported request log filter fields: The syntax basically follows the format
To group and combine several expressions you could use parenthesis
|
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": {}
}