Learn R Programming

otelsdk (version 0.2.2)

logger_provider_file: Logger provider to write log messages into a JSONL file.

Description

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.

Usage

Externally:

OTEL_LOGS_EXPORTER=otlp/file

From R:

logger_provider_file$new(opts = NULL)
logger_provider_file$options()

Arguments

  • opts: Named list of options. See below.

Options

File exporter options

  • file_pattern: Output file pattern. Value is set from:

    • opts argument, or

    • OTEL_EXPORTER_OTLP_LOGS_FILE environment variable, or

    • OTEL_EXPORTER_OTLP_FILE environment variable, or

    • the 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, or

    • OTEL_EXPORTER_OTLP_LOGS_FILE_ALIAS environment variable, or

    • OTEL_EXPORTER_OTLP_FILE_ALIAS environment variable, or

    • the 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 from

    • opts argument, or

    • OTEL_EXPORTER_OTLP_LOGS_FILE_FLUSH_INTERVAL environment variable, or

    • OTEL_EXPORTER_OTLP_FILE_FLUSH_INTERVAL environment variable, or

    • the default is 30s, thirty seconds.

  • flush_count: Force flush output after every flush_count records. Value is set from

    • opts argument, or

    • OTEL_EXPORTER_OTLP_LOGS_FILE_FLUSH_COUNT environment variable, or

    • OTEL_EXPORTER_OTLP_FILE_FLUSH_COUNT environment variable, or

    • the default is 256.

  • file_size: File size to rotate output files. A file size specification, see File Size Options. Value is set from

    • opts argument, or

    • OTEL_EXPORTER_OTLP_LOGS_FILE_FILE_SIZE environment variable, or

    • OTEL_EXPORTER_OTLP_FILE_FILE_SIZE environment variable, or

    • the default is 20MB.

  • rotate_size: How many rotated output files to keep. Value is set from

    • opts argument, or

    • OTEL_EXPORTER_OTLP_LOGS_FILE_ROTATE_SIZE environment variable, or

    • OTEL_EXPORTER_OTLP_FILE_ROTATE_SIZE environment variable, or

    • the 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.

    Examples

    Run this code
    logger_provider_file$options()
    

    Run the code above in your browser using DataLab