Last updated: May 29, 2026
Manage Spam Filters as Code
Spam filters drop unwanted logs, spans, and metric data points at the ingestion pipeline before they reach storage and before you are charged for them. 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.
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
12345678910111213apiVersion: v1alpha2kind: Dash0SpamFiltermetadata:name: drop-health-checkslabels:dash0.com/id: 43f4ac1b-c9e3-4a5b-836f-4de4b449607ddash0.com/source: uispec:context: logfilter:- key: service.nameoperator: isvalue: health-check
The 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
1234567891011121314# Apply the spam filterkubectl apply -f spam-filter.yaml# List all spam filterskubectl get dash0spamfilters -n monitoring# View detailskubectl describe dash0spamfilter drop-kube-system-logs -n monitoring# Update the spam filterkubectl edit dash0spamfilter drop-kube-system-logs -n monitoring# Delete the spam filterkubectl delete dash0spamfilter drop-kube-system-logs -n monitoring
For 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
12345678910111213141516171819202122232425262728293031terraform {required_providers {dash0 = {source = "dash0hq/dash0"version = "~> 1.0"}}}provider "dash0" {api_token = var.dash0_api_tokenendpoint = "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 = <<-EOFapiVersion: v1alpha2kind: Dash0SpamFiltermetadata:name: Drop debug logsspec:context: logfilter:- key: "severity_text"operator: "is"value: "DEBUG"EOF}
For more information, see the Dash0 Terraform provider documentation.
Dash0 CLI
Script spam filter operations with the Dash0 CLI for automated deployments and batch operations.
Create from File
12# Create a spam filter from a YAML filedash0 -X spam-filters create --dataset production -f drop-health-checks.yaml
List Spam Filters
12# List all spam filters in a datasetdash0 -X spam-filters list --dataset production
Get Spam Filter Details
12345# Get a single spam filter as YAMLdash0 -X spam-filters get --dataset production <id> -o yaml# Get spam filter details in JSON formatdash0 -X spam-filters get --dataset production <id> -o json
Update Spam Filter
12# Update an existing spam filterdash0 -X spam-filters update --dataset production <id> -f drop-health-checks-updated.yaml
Delete Spam Filter
12# Delete a spam filterdash0 -X spam-filters delete --dataset production <id>
For more information, see the Dash0 CLI documentation.
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.