The --config
flag accepts either a file path or values in the form of a config URI "<scheme>:<opaque_data>"
. Currently, the
OpenTelemetry Collector supports the following providers scheme
:
- file - Reads configuration from a file. E.g.
file:path/to/config.yaml
. - env - Reads configuration from an environment variable. E.g.
env:MY_CONFIG_IN_AN_ENVVAR
. - yaml - Reads configuration from yaml bytes. E.g.
yaml:exporters::logging::loglevel: debug
.
For more technical details about how configuration is resolved you can read the configuration resolving design.
-
Simple local file:
./otelcorecol --config=examples/local/otel-config.yaml
-
Simple local file using the new URI format:
./otelcorecol --config=file:examples/local/otel-config.yaml
-
Config provided via an environment variable:
./otelcorecol --config=env:MY_CONFIG_IN_AN_ENVVAR
-
Merge a
otel-config.yaml
file with the content of an environment variableMY_OTHER_CONFIG
and use the merged result as the config:./otelcorecol --config=file:examples/local/otel-config.yaml --config=env:MY_OTHER_CONFIG
-
Merge a
config.yaml
file with the content of a yaml bytes configuration (overwrites theexporters::logging::loglevel
config) and use the content as the config:./otelcorecol --config=file:examples/local/otel-config.yaml --config="yaml:exporters::logging::loglevel: info"