Skip to main content

Fetching Logs Programmatically

You can fetch logs for your instances, connections, data sources, and other Prismatic resources programmatically using the events) query. An event currently represents a log entry, and may represent additional resources (such as step results) in the future. To filter for log entries specifically, pass typeIn: [LOG_EVENT] to the query.

Querying logs

Use the events query with typeIn: [LOG_EVENT] to fetch log entries. Because Event is a union type, use an inline fragment (... on LogEvent) to select log-specific fields:

Fetch Log Events
query FetchLogs($timestampGte: DateTime!, $timestampLte: DateTime!) {
events(
typeIn: [LOG_EVENT]
orderBy: { field: TIMESTAMP, direction: DESC }
timestampGte: $timestampGte
timestampLte: $timestampLte
) {
nodes {
id
timestamp
... on LogEvent {
logType
message
flowName
severity
instanceId
instanceName
customerName
integrationName
instanceType
executionResultId
requiredConfigVariableKey
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
Query Variables
{
"timestampGte": "2026-04-22T00:15:30.726000+00:00",
"timestampLte": "2026-04-22T16:15:28.510000+00:00"
}
Queries are time-boxed

If you omit either timestampGte or timestampLte, the query is time-boxed to a two-hour range by default. If you specify neither argument, the query returns logs from the past two hours. To query a longer window, supply both timestamps explicitly.

LogEvent fields

The fields available on a LogEvent node include:

FieldDescription
idThe unique identifier for the event.
timestampThe time the log entry was recorded.
logTypeThe source of the log: EXECUTION, CONNECTION, DATA_SOURCE, MANAGEMENT, or RATE_LIMIT.
messageThe log message text.
severityThe log level: FATAL, ERROR, WARN, INFO, DEBUG, TRACE, or METRIC.
flowNameThe name of the flow that produced the log (when applicable).
instanceIdThe ID of the instance that produced the log.
instanceNameThe name of the instance that produced the log.
instanceTypeINTEGRATION for a standard instance, or WORKFLOW for an embedded customer workflow.
customerNameThe name of the customer associated with the instance.
integrationNameThe name of the integration associated with the instance.
executionResultIdThe ID of the execution result this log was produced during, when applicable.
requiredConfigVariableKeyThe key of the config variable this log is associated with, for connection and data source logs.

Filtering logs

Narrow your results by combining the events query arguments:

  • By time range - pass both timestampGte and timestampLte as ISO 8601 timestamps to query a specific window.
  • By log type and severity - use filterGroups to filter on logType (for example, EXECUTION vs. CONNECTION) or severity (for example, ERROR vs. INFO).
  • By flow, instance, customer, or integration - use filterGroups to filter on fields like instanceId or flowName.

Paginating through results

Like other Prismatic queries, the events query returns up to 100 nodes per page. If pageInfo.hasNextPage is true, use the pageInfo.endCursor value as the after argument on your next request to fetch the next page. For more information, see Pagination.

Fetching logs with Node.js

The example below fetches all log events in a time window, paging through results until every page has been processed. It prints each log entry to the console.

Fetching Logs with Node.js
const PRISMATIC_URL =
process.env.PRISMATIC_URL || "https://app.prismatic.io/api";
const PRISMATIC_API_KEY = process.env.PRISMATIC_API_KEY;

const query = `query FetchLogs($timestampGte: DateTime!, $timestampLte: DateTime!, $after: String) {
events(
typeIn: [LOG_EVENT]
orderBy: { field: TIMESTAMP, direction: DESC }
timestampGte: $timestampGte
timestampLte: $timestampLte
after: $after
) {
nodes {
id
timestamp
... on LogEvent {
logType
message
flowName
severity
instanceName
customerName
integrationName
executionResultId
}
}
pageInfo {
hasNextPage
endCursor
}
}
}`;

async function fetchLogs(timestampGte, timestampLte) {
let after = null;
const logs = [];

do {
const response = await fetch(PRISMATIC_URL, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${PRISMATIC_API_KEY}`,
},
body: JSON.stringify({
query,
variables: { timestampGte, timestampLte, after },
}),
});

const { data, errors } = await response.json();
if (errors) {
throw new Error(JSON.stringify(errors));
}

logs.push(...data.events.nodes);
after = data.events.pageInfo.hasNextPage
? data.events.pageInfo.endCursor
: null;
} while (after);

return logs;
}

async function main() {
const logs = await fetchLogs(
"2026-04-22T00:00:00+00:00",
"2026-04-22T23:59:59+00:00",
);

for (const log of logs) {
console.log(
`[${log.timestamp}] ${log.severity} ${log.logType} - ${log.message}`,
);
}
}

main();