How to retrieve stdout/stderr logs for a step using GraphQL
Last updated: October 27, 2025
To get stdout/stderr logs for a specific step, you'll need to make two GraphQL queries:
First to get the
logKeyThen to retrieve the download URLs.
First query to get the logKey:
First query:
query GetLogCaptureEventsForRun($runId: ID!) {
logsForRun(runId: $runId) {
... on EventConnection {
events {
... on LogsCapturedEvent {
logKey
stepKeys
}
}
}
}
}Second query:
query CapturedLogsMetadataQuery($logKey: [String!]!) {
capturedLogsMetadata(logKey: $logKey) {
stdoutDownloadUrl
stderrDownloadUrl
}
}Follow these steps to retrieve the logs:
Execute the first query with your run ID to get the logKey for your specific step
Find the LogsCapturedEvent that corresponds to your step
Use the logKey from step 2 in the second query
The response will contain URLs to download the full stdout and stderr logs
In Dagster+, the logs are typically stored in S3, and the URLs returned will be pre-signed links that allow you to download the log files directly. This enables access to complete log information for debugging and monitoring purposes.
For more information about Dagster's logging system, you can refer to the discussion here.