Skip to main content

Audit Log

Usageโ€‹

import { epilot } from '@epilot/sdk'

epilot.authorize(() => '<token>')
const { data } = await epilot.auditLogs.getLogs(...)

Tree-shakeable importโ€‹

import { getClient, authorize } from '@epilot/sdk/audit-logs'

const auditLogsClient = getClient()
authorize(auditLogsClient, () => '<token>')
const { data } = await auditLogsClient.getLogs(...)

Operationsโ€‹

Events

Audit Log

Schemas

getLogsโ€‹

Retrieve Audit Log events. Optionally, you can filter them by organization.

POST /v1/logs

const { data } = await client.getLogs(
null,
{
limit: 50,
page: 0,
timestamp: '2021-06-01T12:00:00Z',
service_name: 'workflows',
event_name: 'deleteWorkflow',
outcome: 'success',
method: 'POST',
user: {
email: 'max.mustermann@mail.com',
user_id: 123456
}
},
)
Response
{
"logs": [
{
"id": "2843c005-c5b0-4df2-94ee-1ca2ddd998ac",
"org_id": 123456,
"service_name": "workflows",
"event_name": "deleteWorkflow",
"status_code": 200,
"timestamp": "2021-06-01T12:00:00Z",
"caller": {
"user_email": "max.mustermann@mail.com",
"user_id": 123456,
"trigger_type": "user"
},
"http": {
"method": "GET",
"ip": null,
"headers": {
"Authorization": "Bearer token"
},
"query": {
"limit": 50,
"page": 0
},
"pathParams": {
"eventId": "2843c005-c5b0-4df2-94ee-1ca2ddd998ac"
},
"path": "/v1/logs",
"domainName": "audit-logs.sls.epilot.io"
},
"detail": "{\"workflow_id\": \"123456\"}",
"activity": "Workflow with ID 123456 was deleted",
"source_url": "string"
}
],
"total": 1
}

getLogByIdโ€‹

Retrieve Audit Log events

GET /v1/logs/{logId}

const { data } = await client.getLogById({
logId: 'example',
})
Response
{
"log": {
"id": "2843c005-c5b0-4df2-94ee-1ca2ddd998ac",
"org_id": 123456,
"service_name": "workflows",
"event_name": "deleteWorkflow",
"status_code": 200,
"timestamp": "2021-06-01T12:00:00Z",
"caller": {
"user_email": "max.mustermann@mail.com",
"user_id": 123456,
"trigger_type": "user"
},
"http": {
"method": "GET",
"ip": null,
"headers": {
"Authorization": "Bearer token"
},
"query": {
"limit": 50,
"page": 0
},
"pathParams": {
"eventId": "2843c005-c5b0-4df2-94ee-1ca2ddd998ac"
},
"path": "/v1/logs",
"domainName": "audit-logs.sls.epilot.io"
},
"detail": "{\"workflow_id\": \"123456\"}",
"activity": "Workflow with ID 123456 was deleted",
"source_url": "string"
}
}

Schemasโ€‹

SearchOptionsโ€‹

type SearchOptions = {
limit?: number
page?: number
timestamp?: {
from?: string
to?: string
}
service_name?: string
event_name?: string
outcome?: "success" | "failure"
method?: string
user?: {
email?: string
user_id?: string
}
}

HttpContextโ€‹

type HttpContext = {
method?: string
ip?: string
headers?: object
query?: object
pathParams?: object
path?: string
domainName?: string
}

Callerโ€‹

type Caller = {
user_email?: string
user_id?: string
trigger_type?: "user" | "api" | "automation"
}

Eventโ€‹

type Event = {
id?: string // uuid
org_id?: string
service_name?: string
event_name?: string
status_code?: number
timestamp?: string
caller?: {
user_email?: string
user_id?: string
trigger_type?: "user" | "api" | "automation"
}
http?: {
method?: string
ip?: string
headers?: object
query?: object
pathParams?: object
path?: string
domainName?: string
}
detail?: string
activity?: string
source_url?: string
}