Documentation

Manage InfluxDB logs

Learn how to configure, manage, and process your InfluxDB logs:

Configure your InfluxDB log location

By default, InfluxDB outputs all logs to stdout. To view InfluxDB logs, view the output of the influxd process.

Write logs to a file

To write InfluxDB logs to a file, redirect stdout to a file when starting the InfluxDB service (influxd).

influxd 1> /path/to/influxdb.log
  • Copy
  • Fill window

When logging to a file, InfluxDB uses the logfmt format.

Logs when running InfluxDB as a service

If you use a service manager to run InfluxDB, the service manager determines the location of logs.

Most Linux systems direct logs to the systemd journal. To access these logs, use the following command:

sudo journalctl -u influxdb.service
  • Copy
  • Fill window

For more information, see the journald.conf documentation.

When InfluxDB is run as a service, stdout is discarded by default (sent to /dev/null). To write logs to a file:

  1. Open the InfluxDB startup script (/etc/default/influxdb) in a text editor.

  2. Set the STDOUT environment variable to the path where you want to store the InfluxDB logs. For example:

    STDOUT=/var/log/influxdb/influxd.log
    
    • Copy
    • Fill window
  3. Save the changes to the startup script.

  4. Restart the InfluxDB service to apply the changes.

    service influxdb restart
    
    • Copy
    • Fill window

Configure your log level

Use the log-level InfluxDB configuration option to specify the log levels the InfluxDB service outputs. InfluxDB supports the following log levels:

  • debug: Output logs with debug, info, and error log levels.
  • info: (Default) Output logs with info and error log levels.
  • error: Output logs with the error log level only.
influxd --log-level=info
  • Copy
  • Fill window
export INFLUXD_LOG_LEVEL=info
  • Copy
  • Fill window
log-level: info
  • Copy
  • Fill window
log-level = "info"
  • Copy
  • Fill window
{
  "log-level": "info"
}
  • Copy
  • Fill window

For information about configuring InfluxDB, see InfluxDB configuration options.

Enable the Flux query log

Use the flux-log-enabled configuration option to enable Flux query logging. InfluxDB outputs Flux query logs to stdout with all other InfluxDB logs.

influxd --flux-log-enabled
  • Copy
  • Fill window
export INFLUXD_FLUX_LOG_ENABLED=true
  • Copy
  • Fill window
flux-log-enabled: true
  • Copy
  • Fill window
flux-log-enabled = true
  • Copy
  • Fill window
{
  "flux-log-enabled": true
}
  • Copy
  • Fill window

For information about configuring InfluxDB, see InfluxDB configuration options.

Use external tools to manage and process logs

Use the following popular tools to manage and process InfluxDB logs:

logrotate

logrotate simplifies the administration of log files and provides automatic rotation compression, removal and mailing of log files. Logrotate can be set to handle a log file hourly, daily, weekly, monthly or when the log file gets to a certain size.

hutils

hutils is a collection of command line utilities for working with logs with logfmt encoding, including:

  • lcut: Extracts values from a logfmt trace based on a specified field name.
  • lfmt: Reformats and highlights key sections of logfmt lines.
  • ltap: Accesses messages from log providers in a consistent way to allow easy parsing by other utilities that operate on logfmt traces.
  • lviz: Visualizes logfmt output by building a tree out of a dataset combining common sets of key-value pairs into shared parent nodes.

lnav (Log File Navigator) is an advanced log file viewer useful for watching and analyzing log files from a terminal. The lnav viewer provides a single log view, automatic log format detection, filtering, timeline view, pretty-print view, and querying logs using SQL.

Log formats

InfluxDB outputs logs in one of two formats depending on the location of where logs are output.

Console/TTY

When logging to a terminal or other TTY devices, InfluxDB uses a console-friendly format.

Example console/TTY format
2022-09-29T21:58:29.936355Z	info	Welcome to InfluxDB	{"log_id": "0dEoz3C0000", "version": "dev", "commit": "663d43d210", "build_date": "2022-09-29T21:58:29Z", "log_level": "info"}
2022-09-29T21:58:29.977671Z	info	Resources opened	{"log_id": "0dEoz3C0000", "service": "bolt", "path": "/Users/exampleuser/.influxdbv2/influxd.bolt"}
2022-09-29T21:58:29.977891Z	info	Resources opened	{"log_id": "0dEoz3C0000", "service": "sqlite", "path": "/Users/exampleuser/.influxdbv2/influxd.sqlite"}
2022-09-29T21:58:30.059709Z	info	Checking InfluxDB metadata for prior version.	{"log_id": "0dEoz3C0000", "bolt_path": "/Users/exampleuser/.influxdbv2/influxd.bolt"}
  • Copy
  • Fill window

logfmt

When logging to a file, InfluxDB uses logfmt, a machine-readable structured log format that provides simpler integrations with external tools like Splunk, Papertrail, Elasticsearch, and other third party tools.

Example logfmt format
ts=2022-09-29T16:54:16.021427Z lvl=info msg="Welcome to InfluxDB" log_id=0dEYZvqG000 version=dev commit=663d43d210 build_date=2022-09-29T16:54:15Z log_level=info
ts=2022-09-29T16:54:16.062239Z lvl=info msg="Resources opened" log_id=0dEYZvqG000 service=bolt path=/Users/exampleuser/.influxdbv2/influxd.bolt
ts=2022-09-29T16:54:16.062457Z lvl=info msg="Resources opened" log_id=0dEYZvqG000 service=sqlite path=/Users/exampleuser/.influxdbv2/influxd.sqlite
ts=2022-09-29T16:54:16.144430Z lvl=info msg="Checking InfluxDB metadata for prior version." log_id=0dEYZvqG000 bolt_path=/Users/exampleuser/.influxdbv2/influxd.bolt
  • Copy
  • Fill window

Was this page helpful?

Thank you for your feedback!


The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Read more

InfluxDB 3 Core and Enterprise are now in Beta

InfluxDB 3 Core and Enterprise are now available for beta testing, available under MIT or Apache 2 license.

InfluxDB 3 Core is a high-speed, recent-data engine that collects and processes data in real-time, while persisting it to local disk or object storage. InfluxDB 3 Enterprise is a commercial product that builds on Core’s foundation, adding high availability, read replicas, enhanced security, and data compaction for faster queries. A free tier of InfluxDB 3 Enterprise will also be available for at-home, non-commercial use for hobbyists to get the full historical time series database set of capabilities.

For more information, check out: