5.0

Logs

Lenses follows the Twelve-Factor App approach: all logs are emitted unbuffered as a stream of events to both stdout and to rotating files inside the directory logs/. With Linux and Containers, one can integrate logging with the existing collection infrastructure.

The logback.xml file is used to configure logging, and a default optimized configuration is bundled with Lenses.

If customisation is required, it is recommended to adapt the default configuration rather than write your own from scratch.

The file can be placed in any of the following directories:

  • the directory where Lenses is started from
  • /etc/lenses/
  • Lenses installation directory.

The first one found, in the above order, is used, but to override this and use a custom location set the following environment variable:

export LENSES_LOG4J_OPTS="-Dlogback.configurationFile=file:/path/to/logback.xml"

Default configuration 

The default configuration file is set up to hot-reload any changes every 30 seconds.

Log Level

The default log level is set to INFO (apart from some very verbose classes).

Log Format

All the log entries are written to the output using the following pattern:

%d{ISO8601} %-5p [%c{2}:%L] [%thread] %m%n

You can adjust this inside logback.xml to match your organization’s defaults.

Log Location

Under logs/ you will find three files: lenses.log, lenses-warn.log and metrics.log. The first contains all logs and is the same as the stdout. The second contains only messages at level WARN and above. The third one contains timing metrics and can be useful for debugging.

Log Buffering

The default configuration contains two cyclic buffer appenders named “CYCLIC-INFO” and “CYCLIC-METRICS”. These appenders are required to expose the Lenses logs within the Admin UI.