Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default Collector configuration path to Configuration docs #3940

Merged
merged 10 commits into from
Feb 7, 2024
67 changes: 62 additions & 5 deletions content/en/docs/collector/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,40 @@ cSpell:ignore: cfssl cfssljson fluentforward gencert genkey hostmetrics initca l

<!-- markdownlint-disable link-fragments -->

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 {#location}

By default, the Collector configuration is located in
`/etc/otelcol/config.yaml`.

You can provide one or more configurations using the `--config` option. For
example:

```shell
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}

The structure of any Collector configuration file consists of four classes of
Expand Down Expand Up @@ -843,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.
Loading