Telegraf Error Guide: 'outputs.influxdb database not found' — Fix Missing InfluxDB DB
Resolve Telegraf's outputs.influxdb database not found errors: create the database, enable skip_database_creation correctly, grant create permissions, and match the database name in config.
- #telegraf
- #metrics
- #troubleshooting
- #errors
Fixing errors like this? Get 500 free DevOps AI prompts
500 copy-paste AI prompts for the stack you actually run — one PDF, free.
Overview
The InfluxDB 1.x output plugin logs this when it writes to a database that does not exist and either cannot or is told not to create it:
E! [outputs.influxdb] When writing to [http://influxdb:8086]: database not found: "telemetry"
By default Telegraf tries to create the database on startup. Seeing database not found at write time means creation was skipped, failed silently due to permissions, or the write targets a different name than the one that was created.
Symptoms
database not found: "..."on every flush; no data ever appears.SHOW DATABASESin InfluxDB does not list the name Telegraf is writing to.- Telegraf was configured with
skip_database_creation = truebut the database was never provisioned. - The write user lacks the privilege to create databases, so auto-create quietly failed.
Common Root Causes
- The database simply does not exist and
skip_database_creation = trueprevented Telegraf from making it. - Auto-create failed on permissions — the Telegraf user can
WRITEbut notCREATE DATABASE. - Name mismatch — Telegraf writes to
telemetrybut the provisioned database ismetrics. - Wrong server — pointing at a fresh/empty InfluxDB instance that never got provisioned.
- A retention policy referenced in config that does not exist on an otherwise-present database.
Diagnostic Workflow
List the databases that actually exist on the target server:
influx -host influxdb -execute 'SHOW DATABASES'
Compare against the plugin config’s database value:
[[outputs.influxdb]]
urls = ["http://influxdb:8086"]
database = "telemetry"
skip_database_creation = false
Reproduce the write and read the raw error from InfluxDB:
curl -i -XPOST "http://influxdb:8086/write?db=telemetry" \
--data-binary 'probe,host=diag value=1'
A 404 body of {"error":"database not found: \"telemetry\""} confirms the database is missing. Create it explicitly (with the RP you need):
influx -host influxdb -execute \
'CREATE DATABASE telemetry WITH DURATION 30d REPLICATION 1 NAME thirty_days'
If you want Telegraf to own creation, ensure the user has the privilege and leave auto-create on:
influx -username admin -password "$ADMIN_PW" \
-execute 'GRANT ALL ON telemetry TO telegraf'
Example Root Cause Analysis
A Kubernetes deployment set skip_database_creation = true as a “best practice” copied from a blog, assuming an operator would pre-create the database. No such operator step existed, so the fresh InfluxDB had only the internal _internal database. SHOW DATABASES proved telemetry was absent. Because the environment used GitOps, the team added a CREATE DATABASE telemetry bootstrap Job to the same manifest and kept skip_database_creation = true so Telegraf never attempted DDL at scale. On the next apply the database existed before Telegraf’s first flush, and the error cleared.
Prevention Best Practices
- Decide explicitly who owns database creation: either leave
skip_database_creation = falsewith a user that hasCREATE DATABASE, or pre-provision it and setskip_database_creation = true— never assume. - Provision the database (and retention policy) as an idempotent bootstrap step in the same automation that deploys Telegraf.
- Reference the database name via an environment variable so config and provisioning cannot drift.
- With many Telegraf agents, prefer pre-creation plus
skip_database_creation = trueso hundreds of agents do not each issue DDL. - Alert on the output error metric so a missing database is caught at deploy, not by an empty dashboard.
Quick Command Reference
# List existing databases
influx -host influxdb -execute 'SHOW DATABASES'
# Reproduce the write
curl -i -XPOST "http://influxdb:8086/write?db=telemetry" \
--data-binary 'probe value=1'
# Create the database with a retention policy
influx -host influxdb -execute \
'CREATE DATABASE telemetry WITH DURATION 30d REPLICATION 1'
# Grant the Telegraf user create/write rights
influx -username admin -password "$ADMIN_PW" \
-execute 'GRANT ALL ON telemetry TO telegraf'
# Watch for the error live
journalctl -u telegraf -f | grep 'database not found'
Conclusion
outputs.influxdb database not found means Telegraf is writing to a database that does not exist, and either skip_database_creation or a missing CREATE DATABASE privilege stopped it from creating one. Confirm with SHOW DATABASES, reconcile the config name, and choose an explicit ownership model for creation. In fleets, pre-provision the database and disable auto-create so agents never issue DDL. For authentication failures instead of missing databases, see the 401 Unauthorized guide. More fixes in the Telegraf guides.
Get 500 Battle-Tested DevOps AI Prompts — Free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.