Skip to main content

LogsSettingsinterface

Properties (24)

Property Type Default Required Description
additionalAttributes⚓︎ { [x: string]: unknown } | (() => { [x: string]: unknown }) x x

Additional logs attributes to publish as part of each log entry, specified as key/value pairs. You can use environment variables as values. Environment variables must start and end with a percent sign (e.g., %MyEnvVar%), and can contain a fallback value (e.g., %MyEnvVar?literalDefaultValue%).

additionalResourceAttributes⚓︎ { [x: string]: unknown } | (() => { [x: string]: unknown }) x x

Additional attributes to publish as part of the OTEL resource definition, specified as key/value pairs. You can use environment variables as values. Environment variables must start and end with a percent sign (e.g., %MyEnvVar%), and can contain a fallback value (e.g., %MyEnvVar?literalDefaultValue%).

A function is asked once, on the first read after the build, and its answer is kept: the SDK's resource is made once, at its creation, and the readers that look at the resource attributes on every span (the span filters' context, the sampler) see the same values.

addResourceAttributesToAttributes⚓︎ boolean false x

Whether to add resource attributes to log entry attributes.

attributeSettings⚓︎ { [x: string]: AttributeSettings } x x

Controls the publishing of specific attributes of the log records, by name. An entry names an attribute by its flattened (dot-separated) name, or everything nested under it - "user" covers "user.id" - and the most specific entry is the one that applies to an attribute. See AttributeSettings for what an entry does ("allow", "drop", "mask"), and attributeSettingsMode for whether the entries are a block list (the default) or an allow list.

Applies to the attributes of every log record - its own and the additional attributes - after the log filters (which match on the attributes as they came, and have allowedAttributes of their own). The attributes of a log record may be nested, and are published as they are: a nested attribute is named by its dotted path ("user.id" for { user: { id } }), a dropped one is taken out of its map - and the map with it, when nothing is left in it - and under a "mask" entry each nested value is masked on its own. A masked value is hashed as everywhere else - keyed per the top-level maskingSettings, 16 characters - so the same value masks to the same string on a log record, a span and a metric value, and is reported to mappingURL the same way.

The "drop" and "mask" entries - never as an allow list - also apply to the resource attributes the logs are published with.

attributeSettingsMode⚓︎ AttributeSettingsMode x x

How the attributeSettings read: "blocklist" (the default) publishes everything except the attributes with a "drop" entry - an "allow" entry is the exception to a broader "drop" ("user" dropped, "user.name" allowed); "allowlist" publishes only the attributes with an "allow" or a "mask" entry - without any entries, no attributes at all. About the attributes of the log records: the resource attributes are never read as an allow list.

compression⚓︎ CompressionAlgorithm x x

Compression algorithm to use when exporting logs.

concurrencyLimit⚓︎ number x x

Maximum number of concurrent logs export requests.

defaults⚓︎ LogOptions x x

Default settings if appropriate entries aren't found in 'filters' collection.

enabled⚓︎ boolean false

Whether logging functionality is enabled. If disabled, API is still usable, but methods are no-ops.

exporterSettings⚓︎ OTLPExporterConfigBase x x

Settings for the OTLP exporter used to send logs.

filters⚓︎ LogFilter[] x x

Array of filter entries used to determine whether a particular log entry will be emitted, and which attributes will be included.

If no matching filter entry is found, the settings from 'defaults' are used.

headers⚓︎ { [x: string]: string } | (() => { [x: string]: string }) | (() => Promise<{ [x: string]: string }>) x x

Additional headers to send in HTTP requests, e.g. when using HTTP exporters.

keepAlive⚓︎ boolean true x

Whether to keep the connection alive when sending logs.

logExporters⚓︎ (exporterSettings: OTLPExporterNodeConfigBase, settings: LogsSettings, otelSettings: Settings) => LogRecordExporter[] x x

Log record exporters.

loggerProvider⚓︎ (loggerProviderSettings: LoggerProviderConfig, settings: LogsSettings, otelSettings: Settings) => LoggerProvider x x

Logger provider instance.

loggerProviderSettings⚓︎ LoggerProviderConfig x x

Configuration for the logger provider.

logProcessors⚓︎ (processorSettings: BatchLogRecordProcessorOptions | undefined, exporterSettings: OTLPExporterNodeConfigBase, settings: LogsSettings, otelSettings: Settings) => LogRecordProcessor[] x x

Log record processors.

maxAttributeDepth⚓︎ number 5 x

How deep the library should recurse into objects when adding labels to logs.

processorSettings⚓︎ BatchLogRecordProcessorOptions x x

Settings for batching log records before export.

publishInterval⚓︎ number x x

Interval in milliseconds between logs export batches.

ssoAuth⚓︎ SSOAuthSettings x x

Overrides the properties of the top-level ssoAuth for the logs export requests; the ones that aren't specified here are taken from it.

timeoutMillis⚓︎ number 10000ms. x

Maximum time the OTLP exporter will wait for each batch export.

url⚓︎ string x x

OTLP logs exporter endpoint URL.

useDefaultFilters⚓︎ boolean true x

If true, use a predefined list of filters for well-known platform logs.