Logging

HarperDB maintains a log of events that take place throughout operation. Log messages can be used for diagnostics purposes as well as database monitoring.

 

The log file location is defined in the HarperDB Configuration File.

hdb_log.log

The HarperDB log writes all messages as JSON objects, each containing the following attributes:

  • level: The severity of the message.
  • message: Title of the message.
  • timestamp: The timestamp of the message in ISO-8601 format.

 

Logs can be queried via the API using the read_log operation.

Example Log Message

Note, this example has been formatted for readability.

{
  "level": "notify",
  "message": "HarperDB successfully started",
  "timestamp": "2020-10-28T18:09:41.311Z"
}

Log File vs Standard Streams

HarperDB logs can optionally be streamed to standard streams. Logging to standard streams (stdout/stderr) is primarily used for container logging drivers. For more traditional installations, we recommend logging to a file. Logging to both standard streams and to a file can be enabled simultaneously.

 

To log to standard streams effectively, both RUN_IN_FOREGROUND and LOG_TO_STDSTREAMS must be set to true. Note, logging to standard streams only will disable clustering catchup.