Logger
Bento logging prints to stdout (or stderr if your output is stdout) and is formatted as logfmt by default. Use these configuration options to change both the logging formats as well as the destination of logs.
- Logfmt to Stdout
- JSON to File
logger:
level: INFO
format: logfmt
add_timestamp: false
static_fields:
'@service': bento
logger:
level: WARN
format: json
file:
path: ./logs/bento.ndjson
rotate: true
Fields
level
Set the minimum severity level for emitting logs.
Type: string
Default: "INFO"
Options: OFF
, FATAL
, ERROR
, WARN
, INFO
, DEBUG
, TRACE
, ALL
, NONE
.
format
Set the format of emitted logs.
Type: string
Default: "logfmt"
Options: json
, logfmt
.
add_timestamp
Whether to include timestamps in logs.
Type: bool
Default: false
level_name
The name of the level field added to logs when the format
is json
.
Type: string
Default: "level"
timestamp_name
The name of the timestamp field added to logs when add_timestamp
is set to true
and the format
is json
.
Type: string
Default: "time"
message_name
The name of the message field added to logs when the format
is json
.
Type: string
Default: "msg"
static_fields
A map of key/value pairs to add to each structured log.
Type: map of string
Default: {"@service":"bento"}
file
Experimental: Specify fields for optionally writing logs to a file.
Type: object
file.path
The file path to write logs to, if the file does not exist it will be created. Leave this field empty or unset to disable file based logging.
Type: string
Default: ""
file.rotate
Whether to rotate log files automatically.
Type: bool
Default: false
file.rotate_max_age_days
The maximum number of days to retain old log files based on the timestamp encoded in their filename, after which they are deleted. Setting to zero disables this mechanism.
Type: int
Default: 0
log_all_errors
Experimental: When set, the logger will promote any log containing an error
type to the ERROR
level.
Type: bool
Default: false
Requires version 1.4.0 or newer