Issue
I have set MinimumEventLevel to Warning or Error, but I still see issues of level Info in Sentry.
Applies To
All SaaS Customers and Self-Hosted Users
Error Monitoring
SDK Configuration
Resolution
MinimumEventLevel only controls the logging integration. It sets the minimum log level a message must reach to be sent as an event through a logging integration such as Microsoft.Extensions.Logging, ASP.NET Core, or Serilog (its default is Error). It does not apply to events captured directly through the SDK, for example SentrySdk.CaptureMessage("...", SentryLevel.Info) or SentrySdk.CaptureException(...), or to unhandled exceptions. Those bypass MinimumEventLevel, which is why Info events can still reach Sentry.
To drop events by level regardless of their source, filter them in SetBeforeSend. Inspect sentryEvent.Level and return null to drop the event or return the event to send it:
options.SetBeforeSend((sentryEvent, hint) =>
{
// Drop any event below the Warning level
if (sentryEvent.Level is not null && sentryEvent.Level < SentryLevel.Warning)
{
return null;
}
return sentryEvent;
});
For more ways to filter events, see the .NET filtering documentation.
