Logger provider to write log messages into a JSONL file.
Source:R/logger-provider-file.R
logger_provider_file.Rd
This is the OTLP file exporter.
It writes logs to a JSONL file, each log is a line in the file,
a valid JSON value. The line separator is \n
. The preferred file
extension is jsonl
.
Select this tracer provider with OTEL_LOGS_EXPORTER=otlp/file
.
Value
logger_provider_file$new()
returns an otel::otel_logger_provider
object.
logger_provider_file$options()
returns a named list, the current
values of the options.
Options
File exporter options
file_pattern
: Output file pattern. Value is set from:opts
argument, orOTEL_EXPORTER_OTLP_LOGS_FILE
environment variable, orOTEL_EXPORTER_OTLP_FILE
environment variable, orthe default is:
logs-%N.jsonl
.
May contain placeholders, see below.
alias_pattern
: The file which always point to the latest file. Value is set from:opts
argument, orOTEL_EXPORTER_OTLP_LOGS_FILE_ALIAS
environment variable, orOTEL_EXPORTER_OTLP_FILE_ALIAS environment variable
, orthe default is:
logs-latest.jsonl
.
May contain placeholders, see below.
flush_interval
: Interval to force flush output. A time interval specification, see Time Interval Options. Value is set fromopts
argument, orOTEL_EXPORTER_OTLP_LOGS_FILE_FLUSH_INTERVAL
environment variable, orOTEL_EXPORTER_OTLP_FILE_FLUSH_INTERVAL
environment variable, orthe default is
30s
, thirty seconds.
flush_count
: Force flush output after everyflush_count
records. Value is set fromopts
argument, orOTEL_EXPORTER_OTLP_LOGS_FILE_FLUSH_COUNT
environment variable, orOTEL_EXPORTER_OTLP_FILE_FLUSH_COUNT
environment variable, orthe default is
256
.
file_size
: File size to rotate output files. A file size specification, see File Size Options. Value is set fromopts
argument, orOTEL_EXPORTER_OTLP_LOGS_FILE_FILE_SIZE
environment variable, orOTEL_EXPORTER_OTLP_FILE_FILE_SIZE
environment variable, orthe default is
20MB
.
rotate_size
: How many rotated output files to keep. Value is set fromopts
argument, orOTEL_EXPORTER_OTLP_LOGS_FILE_ROTATE_SIZE
environment variable, orOTEL_EXPORTER_OTLP_FILE_ROTATE_SIZE
environment variable, orthe default is
10
.
Special placeholders are available for file_pattern
and
alias_pattern
:
%Y
: Writes year as a 4 digit decimal number.%y
: Writes last 2 digits of year as a decimal number (range[00,99]
).%m
: Writes month as a decimal number (range[01,12]
).%j
: Writes day of the year as a decimal number (range[001,366]
).%d
: Writes day of the month as a decimal number (range[01,31]
).%w
: Writes weekday as a decimal number, where Sunday is 0 (range[0-6]
).%H
: Writes hour as a decimal number, 24 hour clock (range[00-23]
).%I
: Writes hour as a decimal number, 12 hour clock (range[01,12]
).%M
: Writes minute as a decimal number (range[00,59]
).%S
: Writes second as a decimal number (range[00,60]
).%F
: Equivalent to%Y-%m-%d
(the ISO 8601 date format).%T
: Equivalent to%H:%M:%S
(the ISO 8601 time format).%R
: Equivalent to%H:%M
.%N
: Rotate index, start from 0.%n
: Rotate index, start from 1.