From f5ac359366f2950a979c63c457a0a6e3490e2dfb Mon Sep 17 00:00:00 2001 From: Fabrizio Ferri-Benedetti Date: Mon, 5 Feb 2024 10:32:21 +0100 Subject: [PATCH 1/4] Add config path --- content/en/docs/collector/configuration.md | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/content/en/docs/collector/configuration.md b/content/en/docs/collector/configuration.md index 6e6c8c62c43d..78c0ffde2475 100644 --- a/content/en/docs/collector/configuration.md +++ b/content/en/docs/collector/configuration.md @@ -8,14 +8,25 @@ cSpell:ignore: cfssl cfssljson fluentforward gencert genkey hostmetrics initca l -You can configure the Collector to suit your observability needs. Before you -learn how Collector configuration works, familiarize yourself with the following -content: +You can configure the OpenTelemetry Collector to suit your observability needs. +Before you learn how Collector configuration works, familiarize yourself with +the following content: -- [Data collection concepts][dcc] in order to understand the repositories - applicable to the OpenTelemetry Collector. +- [Data collection concepts][dcc], to understand the repositories applicable to + the OpenTelemetry Collector. - [Security guidance](https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/security-best-practices.md) +## Location of the configuration {#location} + +By default, the Collector configuration is located in +`/etc/otelcol/config.yaml`. + +To use a different configuration file, use the `--config` option. For example: + +```shell +$ otelcol --config=customconfig.yaml +``` + ## Configuration structure {#basics} The structure of any Collector configuration file consists of four classes of From a4b7d8401dda1ab100da1282b7f12ce13e1fd966 Mon Sep 17 00:00:00 2001 From: Fabrizio Ferri-Benedetti Date: Mon, 5 Feb 2024 10:55:44 +0100 Subject: [PATCH 2/4] Add more options --- content/en/docs/collector/configuration.md | 50 +++++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/content/en/docs/collector/configuration.md b/content/en/docs/collector/configuration.md index 78c0ffde2475..f848a7926c5d 100644 --- a/content/en/docs/collector/configuration.md +++ b/content/en/docs/collector/configuration.md @@ -21,10 +21,25 @@ the following content: By default, the Collector configuration is located in `/etc/otelcol/config.yaml`. -To use a different configuration file, use the `--config` option. For example: +You can provide one or more configurations using the `--config` option. For +example: ```shell -$ otelcol --config=customconfig.yaml +otelcol --config=customconfig.yaml +``` + +You can also provide configurations using environment variables, YAML paths, or +HTTP URIs. For example: + +```shell +otelcol --config=env:MY_CONFIG_IN_AN_ENVVAR` --config=https://server/config.yaml +otelcol --config="yaml:exporters::debug::verbosity: normal"` +``` + +To validate a configuration file, use the `validate` command. For example: + +```shell +otelcol validate --config=customconfig.yaml ``` ## Configuration structure {#basics} @@ -854,3 +869,34 @@ This creates two certificates: with the associated key in `cert-key.pem`. [dcc]: /docs/concepts/components/#collector + +## Override settings + +You can override Collector settings using the `--set` option. The settings you +define with this method are merged into the final configuration after all +`--config` sources are resolved and merged. + +The following example shows how to override a setting using different syntax: + +```shell +# Translates to +# key: value +otelcol --set key=value +# Translates to +# outer: +# inner: value +otelcol --set outer.inner=value +# Translates to +# key: +# - a +# - b +# - c +otelcol --set "key=[a, b, c]" +# Translates to +# key: +# a: c +otelcol --set "key={a: c} +``` + +Note tha the `--set` option doesn't support setting a key that contains a dot or +an equal sign. From b7975823da4fd1c4f1923382469bf97989da9a8c Mon Sep 17 00:00:00 2001 From: Fabrizio Ferri-Benedetti Date: Mon, 5 Feb 2024 11:02:12 +0100 Subject: [PATCH 3/4] Remove word --- content/en/docs/collector/configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/docs/collector/configuration.md b/content/en/docs/collector/configuration.md index f848a7926c5d..73f9e93ae2d4 100644 --- a/content/en/docs/collector/configuration.md +++ b/content/en/docs/collector/configuration.md @@ -16,7 +16,7 @@ the following content: the OpenTelemetry Collector. - [Security guidance](https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/security-best-practices.md) -## Location of the configuration {#location} +## Location {#location} By default, the Collector configuration is located in `/etc/otelcol/config.yaml`. From c2d1acff5c3f5c976022b1e4af854398432b8fba Mon Sep 17 00:00:00 2001 From: Fabrizio Ferri-Benedetti Date: Tue, 6 Feb 2024 10:40:35 +0100 Subject: [PATCH 4/4] Integrate feedback --- content/en/docs/collector/configuration.md | 29 ++++++++-------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/content/en/docs/collector/configuration.md b/content/en/docs/collector/configuration.md index 73f9e93ae2d4..419d1c9c7081 100644 --- a/content/en/docs/collector/configuration.md +++ b/content/en/docs/collector/configuration.md @@ -19,7 +19,9 @@ the following content: ## Location {#location} By default, the Collector configuration is located in -`/etc/otelcol/config.yaml`. +`/etc//config.yaml`, where `` can be `otelcol`, +`otelcol-contrib`, or another value, depending on the Collector version or the +Collector distribution you're using. You can provide one or more configurations using the `--config` option. For example: @@ -876,26 +878,15 @@ You can override Collector settings using the `--set` option. The settings you define with this method are merged into the final configuration after all `--config` sources are resolved and merged. -The following example shows how to override a setting using different syntax: +The following examples show how to override settings inside nested sections: ```shell -# Translates to -# key: value -otelcol --set key=value -# Translates to -# outer: -# inner: value -otelcol --set outer.inner=value -# Translates to -# key: -# - a -# - b -# - c -otelcol --set "key=[a, b, c]" -# Translates to -# key: -# a: c -otelcol --set "key={a: c} +# The following example sets the verbosity +# level of the debug exporter to 'detailed' +otelcol --set "exporters::debug::verbosity=detailed" +# The following example overrides gRPC +# settings for the OTLP receiver +otelcol --set "receivers::otlp::protocols::grpc={endpoint:localhost:4317, compression: gzip}" ``` Note tha the `--set` option doesn't support setting a key that contains a dot or