Logs

Learn how to view and stream logs using the Sentry CLI.

The sentry-cli tool can be used to view and stream logs from your Sentry projects. This allows you to monitor your application logs directly from the command line.

To use the logs command, you need to:

  • Install the Sentry CLI
  • Authenticate with Sentry using an auth token
  • Have logs enabled for your project

The logs command uses your Sentry auth token for authentication. You can configure this using:

Copied
sentry-cli login

Or by setting the SENTRY_AUTH_TOKEN environment variable:

Copied
export SENTRY_AUTH_TOKEN=sntrys_YOUR_TOKEN_HERE

Learn more about the CLI's configuration file.

The logs command supports two main operations: listing logs and streaming logs in real-time.

To fetch and display logs:

Copied
sentry-cli logs list --project=my-project --org=my-org

To continuously stream logs in real-time:

Copied
sentry-cli logs list --project=my-project --org=my-org --live

The live streaming mode will continuously poll for new logs and display them as they arrive.

Specify the project and organization explicitly:

Copied
sentry-cli logs list --project=my-project --org=my-org

Or use the default values from your configuration file.

Stream logs from your production application:

Copied
sentry-cli logs list --project=my-app --org=my-org --live

Fetch and display logs from your project:

Copied
sentry-cli logs list --project=my-app --org=my-org

The logs command displays log entries with the following information:

  • Timestamp
  • Log level
  • Message
  • Trace ID (if present)

Log entries are displayed in a readable format, making it easy to monitor your application's logging output directly from the command line.

Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").