Sentry Logs: send, search and alert on logs
Sentry Logs is Sentry's structured logging product. You send logs from the SDK with Sentry.logger or an existing logging integration, search them in Explore > Logs by message text or by any attribute, and each log links to the trace that was active when it was written. The JavaScript SDK supports logs from 9.41.0 (enableLogs: true is needed below 10.71.0), and the Python SDK from 2.35.0. As of November 2026, Developer, Team and Business plans include 5 GB of logs, then $0.50 per GB.
Steps
- Upgrade the SDKUse JavaScript SDK 9.41.0 or later, or Python SDK 2.35.0 or later. Other platforms have their own minimums on their Logs page.
- Enable logs if neededOn JavaScript SDKs below 10.71.0, add enableLogs: true to Sentry.init. Newer versions send logs by default.
- Send a structured logCall Sentry.logger.info (or sentry_sdk.logger.info) with a message and the attributes you will want to search on.
- Search in Explore > LogsFilter by attribute, for example severity:error order_id:order_456, and group the chart by an attribute to find spikes.
- Save the query as an alertUse Save As to create an alert with a static, percent change or anomaly threshold, then choose where it notifies.
Turn on Sentry Logs in your SDK
Logs go through the same SDK and DSN as your errors. There is no separate agent. What you need depends on the SDK version:
| SDK | Logs supported from | Switch needed? |
|---|---|---|
| JavaScript (browser, Node, Next.js and others) | 9.41.0 | enableLogs: true below 10.71.0; on by default from 10.71.0 |
| Python | 2.35.0 | The current docs say logging is on by default |
Sentry also lists Logs setup pages for Java, Android, Apple, Flutter, React Native, PHP, Ruby, Go, Rust, .NET, Native, Unity, Unreal and Godot. Each SDK has its own minimum version, so check that page before you upgrade. Note that the option is enableLogs at the top level of Sentry.init, not under _experiments.
import * as Sentry from "@sentry/node";
Sentry.init({
dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
// Only needed on SDK 9.41.0 up to 10.70.x; on by default from 10.71.0
enableLogs: true,
integrations: [
// Optional: also capture console.log / warn / error as Sentry Logs
Sentry.consoleLoggingIntegration({ levels: ["log", "warn", "error"] }),
],
});
Sentry.logger.info("Checkout completed", {
order_id: order.id,
user_tier: user.plan,
cart_value: cart.total,
duration_ms: Date.now() - startTime,
});
Sentry.logger.error(Sentry.logger.fmt`Payment failed for order ${order.id}`);In Python, sentry_sdk.logger has trace, debug, info, warning, error and fatal. The {name} placeholders turn into searchable attributes. If you already use the standard logging module, LoggingIntegration sends records at INFO and above as Sentry Logs by default. It only creates error events when you set event_level.
import logging
import sentry_sdk
from sentry_sdk.integrations.logging import LoggingIntegration
sentry_sdk.init(
dsn="https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
integrations=[
LoggingIntegration(
level=logging.INFO, # stdlib records sent as Sentry Logs
event_level=logging.ERROR, # and also as error events
),
],
)
sentry_sdk.logger.warning("Rate limit reached for endpoint {endpoint}", endpoint="/api/results/")
logging.getLogger("billing").info("Invoice sent") # arrives via the integrationSearching logs in Explore
Open Explore > Logs. You can search in two ways, and mixing them up is the usual reason a search comes back empty:
- Raw text such as
"Payment failed"only matches the log'smessage, and it is case sensitive. Sentry doesn't run full-text search over the whole log's JSON. - Attributes cover default fields and anything you passed. For example
severity:error,user.id:12345,trace_id:abc123def456,severity:warn OR severity:errororservice:shipping-provider durationMs:>2000.
The chart starts as count(logs). Use Group By under Visualize, for example by gateway or release, to see which value is spiking. The Aggregates tab shows the grouped rows. How far back you can query depends on the plan:
| Plan | Query window |
|---|---|
| Developer | 7 days |
| Team | 14 days |
| Business | 30 days |
Every log carries environment, release, sdk.name and sdk.version. Logs also carry user.id, user.name and user.email when a user is set on the scope. With logger.fmt or Python placeholders you also get message.template and message.parameter.0, message.parameter.1 and so on. Searching on the template finds every variant of the same line.
From a log to its trace, and back
Every log is linked to the trace that was active when it was written. Logs written inside a span also get sentry.trace.parent_span_id, and browser logs get sentry.replay_id while a replay is recording. In practice:
- An alert fires for
severity:error gateway:stripe. - Open one matching log and click through to the trace. The waterfall shows that the payment call took 9 seconds before it failed.
- In that trace, look at every log from the same request. Usually one of them (
Shipping rates fetched, a cache miss, a retry) explains the slowdown. - If the trace includes a replay, open it to see what the user clicked.
For this to work you need tracing turned on. Logs written outside any active span still arrive, but you can't jump from them to a waterfall.
Alerting on logs
In Explore > Logs, enter a query (for example severity:error jobType:*), then choose Save As and create an alert. Sentry's newer UI calls this a monitor. You can pick a Static threshold (the count goes over a value), Percent Change (compared with an earlier period) or Anomaly. Then choose where notifications go. Save As can also store the query, which is shared across Explore, or add it to a dashboard as a widget.
Alert on counts of something you control, like failed jobs, declined payments or slow third-party calls. Don't alert on every error log. Uncaught exceptions already become issues, and duplicating them in log alerts doubles the noise.
What Sentry Logs cost, and how to cut volume
As of November 2026, Sentry's pricing page bills logs by data volume. Developer, Team and Business each include 5 GB, and pay-as-you-go costs $0.50 per additional GB, taken from your shared PAYG budget. See Sentry pricing for the rest of the plan.
The cheapest log is the one you never send. Drop it in the SDK with beforeSendLog in JavaScript or before_send_log in Python. Return null or None to discard it.
Sentry.init({
dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
beforeSendLog: (log) => {
if (log.level === "debug") return null; // drop debug in production
if (log.attributes?.password) delete log.attributes.password;
return log;
},
});Inbound filters by message pattern or release also work. Filtered logs still reach Sentry but don't count against your quota. Sentry recommends one wide log per operation (order id, user tier, duration, outcome) over five thin ones. It costs less and you can search it.
For platforms where you can't install the SDK, log drains forward logs from Vercel, Cloudflare Workers, Heroku and Supabase. You can also send logs to Sentry's OpenTelemetry (OTLP) logs endpoint.
Logs not showing up? Check in this order
- SDK version. It has to be at or above the minimum for logs (JavaScript
9.41.0, Python2.35.0). Below10.71.0, the JavaScript SDK also needsenableLogs: true. - Empty message. The JavaScript SDK doesn't send a log without a message.
- Level.
LoggingIntegrationstarts atINFO, sologger.debug()from the standard library never arrives unless you lowerlevel. - Your own filter. A
beforeSendLogthat returns nothing (a missingreturn log) drops every log. - The search. Raw text is case sensitive and only matches the message, and the time range can't go past your plan's query window.
- Attribute types. In Python, a list of scalars is sent as an array that isn't stored yet, so it shows up empty. Join it into a string first.
Questions
Is Sentry good for logging?
It's a good fit for application logs that you read alongside errors and traces. Logs carry trace IDs, release and user, and you can query any attribute. Query windows are short, though: 7 to 30 days depending on the plan. If you need long-term archives or infrastructure-wide log search, keep a dedicated log store and send Sentry the logs you debug with.
Are Sentry Logs the same as breadcrumbs?
No. Breadcrumbs are attached to a single error event and you only see them on that event. Logs are stored on their own, and you can search, chart and alert on them even when no error happened. With LoggingIntegration, standard library records can become both.
Can I send logs to Sentry without the SDK?
Yes. Log drains forward logs from Vercel, Cloudflare Workers, Heroku and Supabase, and any OpenTelemetry SDK or Collector can send to Sentry's OTLP logs endpoint.
Why does my text search miss logs I can see?
Raw text search is case sensitive and only looks at the message. Values you passed as attributes need an attribute search such as order_id:order_456.
Sources
- Logsdocs.sentry.io
- Set Up Logs for Browser JavaScriptdocs.sentry.io
- Set Up Logs for Pythondocs.sentry.io
- Pricingsentry.io