Examples

Logs

Get all logs with pagination using cursor

Since there can be a large number of logs, they are paginated. You can go through the results using the cursor.

import { Client } from "@upstash/qstash";const client = new Client({ token: "<QSTASH_TOKEN>" });const logs = [];let cursor = null;while (true) {  const res = await client.logs({ cursor });  logs.push(...res.logs);  cursor = res.cursor;  if (!cursor) {    break;  }}

Filter logs by state and limit results

More filters can be found in the API Reference.

import { Client } from "@upstash/qstash";const client = new Client({ token: "<QSTASH_TOKEN>" });const res = await client.logs({  count: 50,  filter: {    state: "DELIVERED",  }});

Fetch logs by message IDs

import { Client } from "@upstash/qstash";const client = new Client({ token: "<QSTASH_TOKEN>" });const res = await client.logs({  messageIds: ["msg-id-1", "msg-id-2"]});
Loading search…