|
1 | | -# OpenTelemetry Collector Service |
2 | | - |
3 | | -## How to provide configuration? |
4 | | - |
5 | | -The `--config` flag accepts either a file path or values in the form of a config URI `"<scheme>:<opaque_data>"`. |
6 | | -Currently, the OpenTelemetry Collector supports the following providers `scheme`: |
7 | | -- [file](../confmap/provider/fileprovider/provider.go) - Reads configuration from a file. E.g. `file:path/to/config.yaml`. |
8 | | -- [env](../confmap/provider/envprovider/provider.go) - Reads configuration from an environment variable. E.g. `env:MY_CONFIG_IN_AN_ENVVAR`. |
9 | | -- [yaml](../confmap/provider/yamlprovider/provider.go) - Reads configuration from yaml bytes. E.g. `yaml:exporters::debug::verbosity: detailed`. |
10 | | -- [http](../confmap/provider/httpprovider/provider.go) - Reads configuration from a HTTP URI. E.g. `http://www.example.com` |
11 | | - |
12 | | -For more technical details about how configuration is resolved you can read the [configuration resolving design](../confmap/README.md#configuration-resolving). |
13 | | - |
14 | | -### Single Config Source |
15 | | - |
16 | | -1. Simple local file: |
17 | | - |
18 | | - `./otelcorecol --config=examples/local/otel-config.yaml` |
19 | | - |
20 | | -2. Simple local file using the new URI format: |
21 | | - |
22 | | - `./otelcorecol --config=file:examples/local/otel-config.yaml` |
23 | | - |
24 | | -3. Config provided via an environment variable: |
25 | | - |
26 | | - `./otelcorecol --config=env:MY_CONFIG_IN_AN_ENVVAR` |
27 | | - |
28 | | - |
29 | | -### Multiple Config Sources |
30 | | - |
31 | | -1. Merge a `otel-config.yaml` file with the content of an environment variable `MY_OTHER_CONFIG` and use the merged result as the config: |
32 | | - |
33 | | - `./otelcorecol --config=file:examples/local/otel-config.yaml --config=env:MY_OTHER_CONFIG` |
34 | | - |
35 | | -2. Merge a `config.yaml` file with the content of a yaml bytes configuration (overwrites the `exporters::debug::verbosity` config) and use the content as the config: |
36 | | - |
37 | | - `./otelcorecol --config=file:examples/local/otel-config.yaml --config="yaml:exporters::debug::verbosity: normal"` |
38 | | - |
39 | | -### Embedding other configuration providers |
40 | | - |
41 | | -One configuration provider can also make references to other config providers, like the following: |
42 | | - |
43 | | -```yaml |
44 | | -receivers: |
45 | | - otlp: |
46 | | - protocols: |
47 | | - grpc: |
48 | | - |
49 | | -exporters: ${file:otlp-exporter.yaml} |
50 | | - |
51 | | -service: |
52 | | - extensions: [ ] |
53 | | - pipelines: |
54 | | - traces: |
55 | | - receivers: [ otlp ] |
56 | | - processors: [ ] |
57 | | - exporters: [ otlp ] |
58 | | -``` |
59 | | -
|
60 | | -## How to override config properties? |
61 | | -
|
62 | | -The `--set` flag allows to set arbitrary config property. The `--set` values are merged into the final configuration |
63 | | -after all the sources specified by the `--config` are resolved and merged. |
64 | | - |
65 | | -### The Format and Limitations of `--set` |
66 | | - |
67 | | -#### Simple property |
68 | | - |
69 | | -The `--set` option takes always one key/value pair, and it is used like this: `--set key=value`. The YAML equivalent of that is: |
70 | | - |
71 | | -```yaml |
72 | | -key: value |
73 | | -``` |
74 | | - |
75 | | -#### Complex nested keys |
76 | | - |
77 | | -Use dot (`.`) in the pair's name as key separator to reference nested map values. For example, `--set outer.inner=value` is translated into this: |
78 | | - |
79 | | -```yaml |
80 | | -outer: |
81 | | - inner: value |
82 | | -``` |
83 | | - |
84 | | -#### Multiple values |
85 | | - |
86 | | -To set multiple values specify multiple --set flags, so `--set a=b --set c=d` becomes: |
87 | | - |
88 | | -```yaml |
89 | | -a: b |
90 | | -c: d |
91 | | -``` |
92 | | - |
93 | | - |
94 | | -#### Array values |
95 | | - |
96 | | -Arrays can be expressed by enclosing values in `[]`. For example, `--set "key=[a, b, c]"` translates to: |
97 | | - |
98 | | -```yaml |
99 | | -key: |
100 | | - - a |
101 | | - - b |
102 | | - - c |
103 | | -``` |
104 | | - |
105 | | -#### Map values |
106 | | - |
107 | | -Maps can be expressed by enclosing values in `{}`. For example, `"--set "key={a: c}"` translates to: |
108 | | - |
109 | | -```yaml |
110 | | -key: |
111 | | - a: c |
112 | | -``` |
113 | | - |
114 | | -#### Limitations |
115 | | - |
116 | | -1. Does not support setting a key that contains a dot `.`. |
117 | | -2. Does not support setting a key that contains a equal sign `=`. |
118 | | -3. The configuration key separator inside the value part of the property is "::". For example `--set "name={a::b: c}"` is equivalent with `--set name.a.b=c`. |
119 | | - |
120 | | -## How to check components available in a distribution |
121 | | - |
122 | | -Use the sub command build-info. Below is an example: |
123 | | - |
124 | | -```bash |
125 | | - ./otelcorecol components |
126 | | -``` |
127 | | -Sample output: |
128 | | - |
129 | | -```yaml |
130 | | -buildinfo: |
131 | | - command: otelcorecol |
132 | | - description: Local OpenTelemetry Collector binary, testing only. |
133 | | - version: 0.62.1-dev |
134 | | -receivers: |
135 | | - - otlp |
136 | | -processors: |
137 | | - - memory_limiter |
138 | | -exporters: |
139 | | - - otlp |
140 | | - - otlp_http |
141 | | - - debug |
142 | | -extensions: |
143 | | - - zpages |
144 | | -``` |
145 | | - |
146 | | -## How to validate configuration file and return all errors without running collector |
147 | | - |
148 | | -```bash |
149 | | - ./otelcorecol validate --config=file:examples/local/otel-config.yaml |
150 | | -``` |
151 | | - |
152 | | -## How to examine the final configuration after resolving, parsing and validating? |
153 | | - |
154 | | -Use `print-config` in the default mode (`--mode=redacted`) and `--feature-gates=otelcol.printInitialConfig`: |
155 | | - |
156 | | -```bash |
157 | | - ./otelcorecol print-config --config=file:examples/local/otel-config.yaml |
158 | | -``` |
159 | | - |
160 | | -Note that by default the configuration will only print when it is |
161 | | -valid, and that sensitive information will be redacted. To print a |
162 | | -potentially invalid configuration, use `--validate=false`. |
163 | | - |
164 | | -## How to examine the final configuration including sensitive fields? |
165 | | - |
166 | | -Use `print-config` with `--mode=unredacted` and `--feature-gates=otelcol.printInitialConfig`: |
167 | | - |
168 | | -```bash |
169 | | - ./otelcorecol print-config --mode=unredacted --config=file:examples/local/otel-config.yaml |
170 | | -``` |
171 | | - |
172 | | -## How to print the final configuration in JSON format? |
173 | | - |
174 | | -Use `print-config` with `--format=json` and |
175 | | -`--feature-gates=otelcol.printInitialConfig`. Note that JSON format is |
176 | | -considered unstable. |
177 | | - |
178 | | -```bash |
179 | | - ./otelcorecol print-config --format=json --config=file:examples/local/otel-config.yaml |
180 | | -``` |
181 | | - |
| 1 | +<!-- status autogenerated section --> |
| 2 | +# Service |
| 3 | +| Status | | |
| 4 | +| ------------- |-----------| |
| 5 | +| Stability | [development]: traces, metrics, logs, profiles | |
| 6 | +| Issues | [](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aopen+is%3Aissue+label%3Apkg%2Fservice) [](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aclosed+is%3Aissue+label%3Apkg%2Fservice) | |
| 7 | + |
| 8 | +[development]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#development |
| 9 | +[core]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol |
| 10 | +[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib |
| 11 | +<!-- end autogenerated section --> |
0 commit comments