Mastering Log Noise Reduction: A Step-by-Step Guide to Grafana Adaptive Logs Drop Rules
Overview
Every observability team knows the pain of sifting through a sea of logs to find the few that matter. Health check pings, forgotten DEBUG statements, and verbose INFO logs from seldom-used services inflate your bill and obscure real issues. Historically, eliminating this noise required painful infrastructure changes or application redeploys. Grafana Cloud Adaptive Logs now offers a simpler solution with drop rules—a feature in public preview that lets you define custom rules to discard low-value log lines before they ever reach storage.
Drop rules complement existing optimization features like intelligent sampling recommendations and exemptions. They give you direct control to drop logs based on labels, log levels, or content. This guide walks you through everything you need to start using drop rules effectively—from prerequisites to common pitfalls.
Prerequisites
Before you begin, ensure you have the following:
- A Grafana Cloud account with access to the Adaptive Logs feature. Drop rules are in public preview, so your stack must be enrolled in the preview.
- Logs flowing into Grafana Cloud from your applications or infrastructure. You can send logs via Promtail, Grafana Agent, or any compatible OTLP exporter.
- Basic familiarity with log labels (e.g.,
service,namespace,level). Labels are key to targeting rules. - Permissions to manage Adaptive Logs settings in Grafana Cloud (typically admin or editor role).
Step-by-Step Guide
Understanding Drop Rule Evaluation Order
Drop rules are evaluated after exemptions but before intelligent pattern recommendations. The processing pipeline for each incoming log line is:
- Exemptions – Any log matching an exemption rule passes through untouched (no sampling).
- Drop rules – Evaluated in priority order (lower priority number = higher priority). The first matching rule applies its drop rate.
- Patterns – Remaining logs that weren't exempted or dropped go through intelligent sampling recommendations.
This order means you can create powerful combinations. For example, you can exempt critical error logs, then drop 100% of DEBUG logs from a noisy service.
Creating a Basic Drop Rule Using the UI
Follow these steps to create a drop rule that removes all DEBUG logs from a specific service:
- Log in to your Grafana Cloud portal and navigate to Adaptive Logs under the Cost Management section.
- Click the Drop Rules tab, then select Add Drop Rule.
- Give your rule a descriptive name, e.g., “Drop DEBUG logs from payment-service”.
- Define the rule criteria. For this example, use a label selector:
service="payment-service"and log level equalsDEBUG. You can also match by line content using a regex. - Set the drop percentage to
100%to discard all matching logs. - Assign a priority (lower numbers are evaluated first). For a blanket rule, use a high priority like
10. - Save the rule. Within minutes, DEBUG logs from that service will stop being ingested.
Creating a Sampling Rule with a Percentage
If you don't want to completely discard a log stream but only reduce its volume, use a drop percentage less than 100%. For instance, to retain only 10% of repetitive job logs:
- Create a new drop rule named “Sample batch-job logs”.
- Use a label selector like
service="batch-processor". - Set the drop percentage to
90%. This drops 90% of matching logs, keeping 10% for analysis. - Optionally add a content filter to only sample specific types of lines, e.g., those containing
"heartbeat".
This technique is ideal for chatty goroutines or periodic health checks that you want to see occasionally but not constantly.
Targeting Noisy Producers with Multiple Criteria
Sometimes a service suddenly starts emitting high volumes of low-value logs. Combine label selectors with log level and text patterns:
- Example: Drop all INFO logs from
service="legacy-worker"that contain the word"retry". Set label selectorservice="legacy-worker", log levelINFO, and line content regex.*retry.*. Drop percentage 100%. - Example: Drop 50% of all DEBUG logs across all services by using a label selector that matches everything
{__name__=~".+"}with log level DEBUG and drop percentage 50%.
Using the API to Manage Rules Programmatically
For automation and CI/CD, drop rules can be managed via the Grafana Cloud API. First, obtain an API token with logs:write scope. Then send a POST request to the Adaptive Logs endpoint:
curl -X POST https://grafana.com/api/stack/your-stack/adaptive-logs/drop-rules \
-H "Authorization: Bearer your-api-token" \
-H "Content-Type: application/json" \
-d '{
"name": "Drop DEBUG from payment-service",
"selector": { "matchLabels": { "service": "payment-service" } },
"logLevel": "DEBUG",
"contentFilter": "",
"dropPercentage": 100,
"priority": 10
}'You can retrieve, update, and delete rules similarly. Check the official API documentation for full details.
Common Mistakes
Accidentally Dropping Important Logs
When combining multiple criteria, ensure your rule doesn't match logs you want to keep. For example, a rule that drops all logs with level INFO might inadvertently drop important informational messages from critical services. Always start with a low drop percentage (e.g., 10%) and monitor the impact before increasing to 100%.
Misunderstanding Priority Order
Drop rules are evaluated in ascending priority order. If two rules could match the same log, the one with the lower priority number applies. A common error is creating a broad rule with a high drop percentage but low priority, which overrides a more specific rule. Use high priority numbers (e.g., 100) for broad rules and low numbers (e.g., 10) for specific ones.
Forgetting to Test in a Staging Environment
Before applying drop rules in production, test them in a staging stack. Use the same log sources but a separate Grafana Cloud instance. This helps you verify that the rules match expected logs and don't cause unexpected data loss.
Ignoring Exemption Interactions
Exemptions are evaluated before drop rules. If a log line matches an exemption, it bypasses all drop rules. This can be good (e.g., never drop error logs) but also surprising if you expect a drop rule to reduce volume. Review your list of exemptions regularly.
Over-relying on Content Filters
Content filters using regex can be computationally expensive and may not match as expected. Test your regex patterns on sample log lines. Prefer label-based filtering where possible, as labels are indexed and faster.
Summary
Adaptive Logs drop rules give you fine-grained control over which logs enter Grafana Cloud, reducing noise and costs. By understanding the evaluation order and crafting precise rules with labels, log levels, and content filters, you can eliminate known noise (like health checks) or sample repetitive logs while keeping critical data intact. Avoid common pitfalls by testing rules gradually, respecting priority, and understanding exemptions. Now you can tame your log volume and focus on what matters.