Configure loggingedit

The logging section of the functionbeat.yml config file contains options for configuring the logging output.

For example, the following options configure Functionbeat to log all the debug messages related to event publishing:

logging.level: debug
logging.selectors: ["publish"]

The logs generated by Functionbeat are written to the CloudWatch log group for the function running on Amazon Web Services (AWS). To view the logs, go to the the monitoring area of the AWS Lambda console and view the CloudWatch log group for the function.

Configuration optionsedit

You can specify the following options in the logging section of the functionbeat.yml config file:

logging.leveledit

Minimum log level. One of debug, info, warning, or error. The default log level is info.

debug
Logs debug messages, including a detailed printout of all events flushed. Also logs informational messages, warnings, errors, and critical errors. When the log level is debug, you can specify a list of selectors to display debug messages for specific components. If no selectors are specified, the * selector is used to display debug messages for all components.
info
Logs informational messages, including the number of events that are published. Also logs any warnings, errors, or critical errors.
warning
Logs warnings, errors, and critical errors.
error
Logs errors and critical errors.

logging.selectorsedit

The list of debugging-only selector tags used by different Functionbeat components. Use * to enable debug output for all components. For example add publish to display all the debug messages related to event publishing.

logging.metrics.enablededit

If enabled, Functionbeat periodically logs its internal metrics that have changed in the last period. For each metric that changed, the delta from the value at the beginning of the period is logged. Also, the total values for all non-zero internal metrics are logged on shutdown. The default is true.

Here is an example log line:

2017-12-17T19:17:42.667-0500    INFO    [metrics]       log/log.go:110  Non-zero metrics in the last 30s: beat.info.uptime.ms=30004 beat.memstats.gc_next=5046416

Note that we currently offer no backwards compatible guarantees for the internal metrics and for this reason they are also not documented.

logging.metrics.periodedit

The period after which to log the internal metrics. The default is 30s.

logging.files.rotateonstartupedit

If the log file already exists on startup, immediately rotate it and start writing to a new file instead of appending to the existing one. Defaults to true.

logging.jsonedit

When true, logs messages in JSON format. The default is false.

logging.ecsedit

When true, logs messages with minimal required Elastic Common Schema (ECS) information.

Logging formatedit

The logging format is generally the same for each logging output. The one exception is with the syslog output where the timestamp is not included in the message because syslog adds its own timestamp.

Each log message consists of the following parts:

  • Timestamp in ISO8601 format
  • Level
  • Logger name contained in brackets (Optional)
  • File name and line number of the caller
  • Message
  • Structured data encoded in JSON (Optional)

Below are some samples:

2017-12-17T18:54:16.241-0500 INFO logp/core_test.go:13 unnamed global logger

2017-12-17T18:54:16.242-0500 INFO [example] logp/core_test.go:16 some message

2017-12-17T18:54:16.242-0500 INFO [example] logp/core_test.go:19 some message {"x": 1}