ListAuditLogs
client.events.list(EventListParams { token, pageSize, filter, 2 more } params, RequestOptionsoptions?): EntriesPage<EventListResponse { id, action, actorId, 4 more } >
POST/gitpod.v1.EventService/ListAuditLogs
Lists audit logs with filtering and pagination options.
Use this method to:
- View audit history
- Track user actions
- Monitor system changes
Examples
-
List all logs:
pagination: pageSize: 20 -
Filter by actor:
filter: actorIds: ["d2c94c27-3b76-4a42-b88c-95a85e392c68"] actorPrincipals: ["PRINCIPAL_USER"] pagination: pageSize: 20 -
Filter by time range:
filter: from: "2024-01-01T00:00:00Z" to: "2024-02-01T00:00:00Z" pagination: pageSize: 20
ListAuditLogs
import Gitpod from '@gitpod/sdk';
const client = new Gitpod({
bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const eventListResponse of client.events.list({
filter: {
actorIds: ['d2c94c27-3b76-4a42-b88c-95a85e392c68'],
actorPrincipals: ['PRINCIPAL_USER'],
},
pagination: { pageSize: 20 },
})) {
console.log(eventListResponse.id);
}{
"entries": [
{
"id": "id",
"action": "action",
"actorId": "actorId",
"actorPrincipal": "PRINCIPAL_UNSPECIFIED",
"createdAt": "2019-12-27T18:11:19.117Z",
"subjectId": "subjectId",
"subjectType": "RESOURCE_TYPE_UNSPECIFIED"
}
],
"pagination": {
"nextToken": "nextToken"
}
}Returns Examples
{
"entries": [
{
"id": "id",
"action": "action",
"actorId": "actorId",
"actorPrincipal": "PRINCIPAL_UNSPECIFIED",
"createdAt": "2019-12-27T18:11:19.117Z",
"subjectId": "subjectId",
"subjectType": "RESOURCE_TYPE_UNSPECIFIED"
}
],
"pagination": {
"nextToken": "nextToken"
}
}