Last updated:
Manage Spam Filters as CodeRelease historyThis feature was introduced by Spam filter support in Infrastructure as Code on May 2, 2026.
Spam filters drop unwanted logs, spans, and metric data points at the ingestion pipeline before they reach storage, so they are never indexed. They can be versioned and managed as infrastructure as code. This approach enables version control, automated deployment pipelines, consistent configuration across environments, and code review for data-hygiene changes.
Spam filters are dataset-scoped resources: each filter belongs to a specific dataset.
Agent0 can generate infrastructure-as-code configurations for spam filters and raise them as pull requests to your repository. After creating a spam filter with Agent0, request the corresponding Terraform configuration or Kubernetes manifest to keep your observability in code. See Asset Creation for details.
Telemetry dropped by a spam filter is not recoverable. Because filters drop individual spans, applying one to span data can leave you with incomplete traces (this differs from client-side sampling). Review filters carefully before applying them.
Dash0 Operator for Kubernetes
Define spam filters as Dash0SpamFilter custom resources that sync to Dash0, enabling workflows and native Kubernetes management.
Example
apiVersion: v1alpha2
kind: Dash0SpamFilter
metadata:
name: drop-health-checks
labels:
dash0.com/id: 43f4ac1b-c9e3-4a5b-836f-4de4b449607d
dash0.com/source: ui
spec:
context: log
filter:
- key: service.name
operator: is
value: health-checkThe Dash0 Operator for Kubernetes watches for Dash0SpamFilter resources and syncs them to your Dash0 dataset. The dataset to which the spam filter is synced is defined by the Dash0Monitoring resource in the Kubernetes namespace where the Dash0SpamFilter resource resides.
Apply and Manage
# Apply the spam filter
kubectl apply -f spam-filter.yaml
# List all spam filters
kubectl get dash0spamfilters -n monitoring
# View details
kubectl describe dash0spamfilter drop-kube-system-logs -n monitoring
# Update the spam filter
kubectl edit dash0spamfilter drop-kube-system-logs -n monitoring
# Delete the spam filter
kubectl delete dash0spamfilter drop-kube-system-logs -n monitoringFor more information, refer to the Dash0 Operator for Kubernetes documentation.
Dash0 Terraform Provider
Manage spam filters in your Terraform infrastructure alongside other cloud resources for unified infrastructure management.
Example Usage
terraform {
required_providers {
dash0 = {
source = "dash0hq/dash0"
version = "~> 1.0"
}
}
}
provider "dash0" {
api_token = var.dash0_api_token
endpoint = "https://api.dash0.com"
}
# v1alpha2 uses a single `context` instead of the v1alpha1 `contexts` list.
resource "dash0_spam_filter" "drop_debug_logs" {
dataset = "default"
spam_filter_yaml = <<-EOF
apiVersion: v1alpha2
kind: Dash0SpamFilter
metadata:
name: Drop debug logs
spec:
context: log
filter:
- key: "severity_text"
operator: "is"
value: "DEBUG"
EOF
}For more information, see the dash0_spam_filter resource documentation.
Dash0 CLI
Script spam filter operations with the Dash0 CLI for automated deployments and batch operations.
Create from File
# Create a spam filter from a YAML file
dash0 -X spam-filters create --dataset production -f drop-health-checks.yamlList Spam Filters
# List all spam filters in a dataset
dash0 -X spam-filters list --dataset productionGet Spam Filter Details
# Get a single spam filter as YAML
dash0 -X spam-filters get --dataset production <id> -o yaml
# Get spam filter details in JSON format
dash0 -X spam-filters get --dataset production <id> -o jsonUpdate Spam Filter
# Update an existing spam filter
dash0 -X spam-filters update --dataset production <id> -f drop-health-checks-updated.yamlDelete Spam Filter
# Delete a spam filter
dash0 -X spam-filters delete --dataset production <id>For more information, see the Dash0 CLI command reference.
Further Reading
- Manage Dashboards as Code — Define and manage dashboards using infrastructure as code.
- Manage Views as Code — Manage saved queries as infrastructure as code.
- Manage Check Rules as Code — Define and manage check rules using infrastructure as code.
- Manage Synthetic Checks as Code — PrometheusRule CRDs with the Dash0 Operator for Kubernetes, Dash0 Terraform provider resources, and Dash0 CLI commands
- Manage Notification Channels as Code — Manage notification channels using infrastructure as code.