Skip to main content
The logs method retrieves workflow run logs using the List Workflow Runs API.

Arguments

cursor
string
A pagination cursor from a previous request. Use this to fetch the next set of results.
count
number
Maximum number of runs to return. Defaults to a system-defined value if not specified.
filter
object
Filter options for narrowing down workflow run logs.

Response

cursor
string
A cursor to use for pagination. If no cursor is returned, there are no more workflow runs.
runs
Array

Usage

import { Client } from "@upstash/workflow";

const client = new Client({ token: "<QSTASH_TOKEN>" })

const { runs, cursor } = await client.logs()

Paginate with cursor

const allRuns = [];
let cursor: string | undefined;
do {
  const result = await client.logs({ cursor });
  allRuns.push(...result.runs);
  cursor = result.cursor;
} while (cursor);

Filter by state

const { runs } = await client.logs({
  filter: {
    state: "RUN_FAILED",
  }
})

Filter by label and date range

const { runs } = await client.logs({
  filter: {
    label: "my-workflow",
    fromDate: new Date("2024-01-01"),
    toDate: new Date("2024-06-01"),
  }
})