Commands
log
View Sentry logs
Commands
sentry log list <org/project-or-trace-id...>
List logs from a project
Arguments:
| Argument | Description |
|---|---|
<org/project-or-trace-id...> | [<org>/[<project>/]]<trace-id>, <org>/<project>, or <project> |
Options:
| Option | Description |
|---|---|
-n, --limit <limit> | Number of log entries (1-1000) (default: "100") |
-q, --query <query> | Filter query (Sentry search syntax) |
-f, --follow <follow> | Stream logs (optionally specify poll interval in seconds) |
-t, --period <period> | Time period (e.g., "30d", "14d", "24h"). Default: 30d (project mode), 14d (trace mode) |
-s, --sort <sort> | Sort order: "newest" (default) or "oldest" (default: "newest") |
--fresh | Bypass cache, re-detect projects, and fetch fresh data |
sentry log view <org/project/log-id...>
View details of one or more log entries
Arguments:
| Argument | Description |
|---|---|
<org/project/log-id...> | [<org>/<project>] <log-id> [<log-id>...] - Target (optional) and one or more log IDs |
Options:
| Option | Description |
|---|---|
-w, --web | Open in browser |
-f, --fresh | Bypass cache, re-detect projects, and fetch fresh data |
All commands support --json for machine-readable output and --fields to select specific JSON fields.
Examples
List logs
# List last 100 logs (default)sentry log listTIMESTAMP LEVEL MESSAGE2024-01-20 14:22:01 info User login successful2024-01-20 14:22:03 debug Processing request for /api/users2024-01-20 14:22:05 error Database connection timeout2024-01-20 14:22:06 warn Retry attempt 1 of 3
Showing 4 logs.Filter logs:
# Show only error logssentry log list -q 'level:error'
# Filter by message contentsentry log list -q 'database'
# Limit resultssentry log list --limit 50Stream logs in real-time
# Stream with default 2-second poll intervalsentry log list -f
# Stream with custom 5-second poll intervalsentry log list -f 5
# Stream error logs from a specific projectsentry log list my-org/backend -f -q 'level:error'View a log entry
sentry log view 968c763c740cfda8b6728f27fb9e9b01Log 968c763c740c...════════════════════
ID: 968c763c740cfda8b6728f27fb9e9b01Timestamp: 2024-01-20 14:22:05Severity: ERROR
Message: Database connection timeout after 30s
─── Context ───
Project: backendEnvironment: productionRelease: 1.2.3
─── Trace ───
Trace ID: abc123def456abc123def456abc12345Span ID: 1234567890abcdef
─── Source Location ───
Function: connect_to_databaseFile: src/db/connection.py:142# With explicit projectsentry log view my-org/backend 968c763c740cfda8b6728f27fb9e9b01
# Open in browsersentry log view 968c763c740cfda8b6728f27fb9e9b01 -wFinding Log IDs
Log IDs can be found:
- In the output of
sentry log list(the ID column) - In the Sentry UI when viewing log entries
- In the
sentry.item_idfield of JSON output
JSON Output
Use --json for machine-readable output:
sentry log list --json | jq '.data[] | select(.severity == "error")'In streaming mode with --json, each log entry is output as a separate JSON object (newline-delimited JSON), making it suitable for piping to other tools.