Log and trace InfluxDB Enterprise operations
InfluxDB writes log output, by default, to stderr
.
Depending on your use case, this log information can be written to another location.
Some service managers may override this default.
Logging locations
Run InfluxDB directly
If you run InfluxDB directly, using influxd
, all logs will be written to stderr
.
You may redirect this log output as you would any output to stderr
like so:
influxdb-meta 2>$HOME/my_log_file # Meta nodes
influxd 2>$HOME/my_log_file # Data nodes
influx-enterprise 2>$HOME/my_log_file # Enterprise Web
Launched as a service
sysvinit
If InfluxDB was installed using a pre-built package, and then launched
as a service, stderr
is redirected to
/var/log/influxdb/<node-type>.log
, and all log data will be written to
that file. You can override this location by setting the variable
STDERR
in the file /etc/default/<node-type>
.
For example, if on a data node /etc/default/influxdb
contains:
STDERR=/dev/null
all log data will be discarded. You can similarly direct output to
stdout
by setting STDOUT
in the same file. Output to stdout
is
sent to /dev/null
by default when InfluxDB is launched as a service.
InfluxDB must be restarted to pick up any changes to /etc/default/<node-type>
.
Meta nodes
For meta nodes, the influxdb-meta
.
The default log file is /var/log/influxdb/influxdb-meta.log
The service configuration file is /etc/default/influxdb-meta
.
Data nodes
For data nodes, the influxdb
.
The default log file is /var/log/influxdb/influxdb.log
The service configuration file is /etc/default/influxdb
.
Enterprise Web
For Enterprise Web nodes, the influx-enterprise
.
The default log file is /var/log/influxdb/influx-enterprise.log
The service configuration file is /etc/default/influx-enterprise
.
systemd
Starting with version 1.0, InfluxDB on systemd systems no longer
writes files to /var/log/<node-type>.log
by default, and now uses the
system configured default for logging (usually journald
). On most
systems, the logs will be directed to the systemd journal and can be
accessed with the command:
sudo journalctl -u <node-type>.service
Please consult the systemd journald documentation for configuring journald.
Meta nodes
For data nodes the influxdb-meta
.
The default log command is sudo journalctl -u influxdb-meta.service
The service configuration file is /etc/default/influxdb-meta
.
Data nodes
For data nodes the influxdb
.
The default log command is sudo journalctl -u influxdb.service
The service configuration file is /etc/default/influxdb
.
Enterprise Web
For data nodes the influx-enterprise
.
The default log command is sudo journalctl -u influx-enterprise.service
The service configuration file is /etc/default/influx-enterprise
.
Use logrotate
You can use logrotate
to rotate the log files generated by InfluxDB on systems where logs are written to flat files.
If using the package install on a sysvinit system, the config file for logrotate is installed in /etc/logrotate.d
.
You can view the file here.
Redirect HTTP access logging
InfluxDB 1.5 introduces the option to log HTTP request traffic separately from the other InfluxDB log output. When HTTP request logging is enabled, the HTTP logs are intermingled by default with internal InfluxDB logging. By redirecting the HTTP request log entries to a separate file, both log files are easier to read, monitor, and debug.
See Redirecting HTTP request logging in the InfluxDB OSS documentation.
Structured logging
With InfluxDB 1.5, structured logging is supported and enable machine-readable and more developer-friendly log output formats. The two new structured log formats, logfmt
and json
, provide easier filtering and searching with external tools and simplifies integration of InfluxDB logs with Splunk, Papertrail, Elasticsearch, and other third party tools.
See Structured logging in the InfluxDB OSS documentation.
Tracing
Logging has been enhanced, starting in InfluxDB 1.5, to provide tracing of important InfluxDB operations. Tracing is useful for error reporting and discovering performance bottlenecks.
See Tracing in the InfluxDB OSS documentation.