The Structure of an OpenTelemetry Collector Configuration File
A beginner-friendly tour of the six sections that make up a Collector configuration, how they connect into pipelines, and the rules that decide what actually runs.
Imagine a busy post office. Parcels arrive through several doors: some are handed over at the counter, some are dropped in a box, some are collected from vans. Inside, workers sort them, stamp them, remove damaged packaging and group them by destination. Finally, trucks carry the parcels out to different cities. There is also a manager’s office that watches over the building, and a big noticeboard that says which doors, workers and trucks are in use today and in what order.
An OpenTelemetry Collector is that post office for telemetry data, and its configuration file is the noticeboard. It lists the doors, the workers, the trucks, the manager’s tools, and, most importantly, the routes that connect them. Once you understand the layout of that noticeboard, every Collector configuration you ever meet, however long, becomes readable. This guide builds that understanding from zero. Every new word is explained when it first appears, and you do not need any earlier experience.
1First, What Is the Collector?
Before reading the map, it helps to know what the building does.
Applications and servers produce telemetry, which is the general name for the information a running system emits about itself so people can understand its behaviour. OpenTelemetry groups telemetry into signals. Traces follow one request through many services. Metrics are numbers measured over time, such as requests per second. Logs are timestamped records of events. Each of these is called a signal.
The OpenTelemetry Collector is a standalone program that receives telemetry, optionally changes it, and sends it onward. It is vendor-neutral, which means it is not tied to any one monitoring product. It can accept data in many formats, and it can deliver data to many destinations at once. Teams run it so that their applications can send data to one nearby place, while all the careful work of filtering, batching, retrying and routing happens in a single, central, configurable program rather than being repeated inside every application.
Think of a travel agent. You give one agent all your plans, and the agent talks to the airline, the hotel and the taxi company on your behalf, in the language each of them expects. The Collector is the travel agent for your telemetry: applications talk to it once, and it handles the many different backends.
Why does it need a configuration file at all?
The Collector program ships without any built-in opinion about what you want. It does not know which formats you will send, which services should receive your data, or what cleaning your data needs. All of that is described in a configuration file, a plain text document that you hand to the Collector when it starts. The Collector reads the file, builds the described components, connects them, and begins working.
Because the file is the single source of truth, changing how telemetry flows is usually a matter of editing the file and restarting, or reloading, the Collector. No application code needs to change. That separation is one of the main reasons teams adopt the Collector in the first place.
One place to change behaviour
Switch backends, add filtering or turn on batching by editing the file, without touching application code.
Many sources, many destinations
One Collector can accept several formats and fan the data out to several backends at the same time.
Safer applications
Retries, buffering and heavy processing happen outside the application, so the application stays lean and fast.
Repeatable setups
A configuration file can be stored in version control, reviewed and reused across environments.
flowchart LR
A["Applications and hosts"] --> B["Collector"]
C["Configuration file"] --> B
B --> D["Backend 1"]
B --> E["Backend 2"]
B --> F["Storage or archive"]
Different builds of the Collector include different sets of components. A configuration can only use components that are compiled into the particular build you run, so the same file may work in one distribution and be rejected by another.
2The Big Picture: Six Top-Level Sections
Every Collector configuration is built from the same six building blocks.
A Collector configuration file is organised into a small number of top-level sections. These are the headings at the very left edge of the file, and each one introduces a family of components. Five of them describe the components themselves. The sixth, called service, decides which of those components are switched on and how they are wired together. Learn these six names and you can orient yourself in any file.
Receivers
The doors. They accept telemetry from outside, either by listening for it or by going out to fetch it.
Processors
The workers. They inspect, change, filter, group or limit data while it passes through.
Exporters
The trucks. They send finished data to a backend, a file, a console or another Collector.
Connectors
The internal bridges. They join one pipeline to another, acting as an exporter on one side and a receiver on the other.
Extensions
The building services. They add helpful abilities that are not part of the data path, such as health checks and authentication.
Service
The noticeboard. It switches components on, defines the pipelines and configures the Collector’s own telemetry.
flowchart TD
R["receivers: define the doors"]
P["processors: define the workers"]
E["exporters: define the trucks"]
C["connectors: define the bridges"]
X["extensions: define the services"]
S["service: switch on and connect"]
R --> S
P --> S
E --> S
C --> S
X --> S
Define first, enable second
The most important idea in the whole file is the split between defining a component and enabling it. The five definition sections are like a catalogue: they describe what is available and how each item is set up. The service section is like an order form: it picks which catalogue items you actually want and in which arrangement. A component that is defined but never mentioned in the service section does nothing at all.
A restaurant has a menu that lists every dish the kitchen knows how to cook. But a table only receives the dishes written on its own order slip. The top-level definition sections are the menu, and the service section is the order slip for this particular Collector.
| Section | Required? | Role | Plain-English meaning |
|---|---|---|---|
| receivers | At least one is needed in practice | Define input components | Where data comes in |
| processors | Optional, but strongly advised | Define transformation components | What happens in the middle |
| exporters | At least one is needed in practice | Define output components | Where data goes out |
| connectors | Optional | Define bridges between pipelines | How pipelines talk to each other |
| extensions | Optional | Define side services | Extra abilities for the Collector |
| service | Required | Enable and connect everything | The plan that is actually executed |
Many beginners believe that writing a receiver section is enough to make the Collector accept data. It is not. Until that receiver is named inside a pipeline in the service section, it is just a description that nobody has asked the Collector to use.
3A Quick Primer on the File Format
The configuration is written in a gentle, human-friendly format, and a few simple rules cover almost everything.
Collector configuration files are written in YAML, a text format designed to be easy for people to read. You do not need to be an expert to read a Collector file. You only need to recognise four ideas, which are described here in words so you can spot them quickly.
Key and value pairs
A name, then a colon, then a value, such as a setting called endpoint followed by an address. This is the basic building block of the whole file.
Nesting through indentation
Settings that belong inside another setting are pushed to the right with spaces. The amount of indentation shows who belongs to whom, so consistent spacing is vital. Tab characters are not allowed for indentation.
Lists
A group of items under one name, each introduced by a dash. Pipelines use lists to name their receivers, processors and exporters, and the order of a list can matter.
Comments
Any text after a hash symbol is ignored by the Collector. Comments are an excellent place to explain why a choice was made.
Indentation in YAML works like the numbered outline of a school essay. A point indented under a heading belongs to that heading. If you push a line too far left or right, it silently joins a different heading, and the meaning of your outline changes without any warning.
Empty definitions are allowed
Many components work perfectly with their default settings. In that case, you simply write the component’s name followed by nothing, or by an empty pair of braces. This is called using the defaults, and it is very common for small, simple components. You only add settings when you want to change something from the default.
Treat the indentation of a Collector file with the same care you would give to brackets in a maths formula. When something behaves strangely, the first thing to check is whether a line is indented under the wrong parent.
Problem
Editing a configuration with a word processor or a tool that mixes tabs and spaces, or that quietly changes quotation marks.
Why It’s Harmful
YAML treats whitespace as meaning. Tabs are invalid for indentation, and fancy quotation marks are no longer quotation marks, so the Collector may fail to start or may read settings differently than intended.
Correct Approach
Use a plain-text editor with YAML support, set it to insert spaces, and validate the file before you deploy it.
4Receivers: The Doors Into the Collector
A receiver is the part of the configuration that decides how telemetry enters.
A receiver accepts telemetry and hands it to the pipeline. Receivers come in two broad styles. A push-based receiver waits and listens: your application sends data to an address, and the receiver accepts it. A pull-based receiver goes out and collects: at regular intervals it contacts something, such as a database or a metrics endpoint, and reads data from it.
A push-based receiver is a letterbox at the front door: people post letters whenever they like. A pull-based receiver is a postman who walks to a neighbour’s house every hour to pick up what is waiting. Both bring letters in, but the movement is in opposite directions.
What a receiver definition contains
Each receiver entry has a name that identifies its type, and underneath it, the settings that tune it. For a listening receiver, the settings usually include the address and port to listen on, which protocols are accepted, and optional security settings. For a collecting receiver, settings usually include the target to contact and how often to do so. Whatever the type, the entry is only a description until a pipeline uses it.
OTLP receiver
Accepts data in the native OpenTelemetry protocol, over gRPC or HTTP. It is the most common door and the usual first choice.
Prometheus receiver
Collects metrics by scraping endpoints in the style used by Prometheus, a popular monitoring system.
Host metrics receiver
Reads facts about the machine itself, such as processor use, memory and disk activity.
File log receiver
Reads log lines from files on disk and turns them into log records that the pipeline can handle.
Many more
There are receivers for Jaeger, Zipkin, Kafka, databases, cloud services and many other systems. Which ones exist depends on your Collector build.
One receiver can serve several signals
Some receivers can bring in more than one kind of signal. An OTLP receiver, for example, can accept traces, metrics and logs through the same door. A single definition can then be used in a traces pipeline, a metrics pipeline and a logs pipeline. Other receivers are limited to one signal, such as a metrics-only receiver. A pipeline can only use a receiver that supports that pipeline’s signal.
Listening receivers default to the local machine, which keeps them private. Many tutorials show an address that accepts connections from anywhere because it is convenient for demonstrations. Use a wide-open address deliberately and only where the network is protected, because it exposes the door to everything that can reach the machine.
5Processors: The Workers in the Middle
Processors are where the Collector earns its keep, by cleaning and shaping data between the door and the truck.
A processor sits between receivers and exporters. It can modify the data, drop parts of it, add information to it, group it into larger bundles, or protect the Collector from overload. Processors are entirely optional, but nearly every real configuration uses at least a few, because raw telemetry is rarely perfect for delivery.
Think of the kitchen between a restaurant’s front door and its dining tables. Ingredients arrive, are washed, cut, seasoned and plated, and only then are they served. Processors are the washing, cutting and plating of telemetry.
Typical jobs of a processor
Protect memory
A memory limiter watches how much memory the Collector is using and pushes back or drops data before the program runs out of memory and crashes.
Batch data
A batch processor groups many small items into larger bundles so that exporting is more efficient and uses fewer network calls.
Add context
Resource-related processors attach facts such as environment, region or cluster name, or detect them automatically from the machine.
Filter and reduce
Filtering and sampling processors remove data you do not want, or keep only a fraction of busy streams, to control volume and cost.
Edit and redact
Attribute and transform processors rename, add or remove fields, which is handy for removing sensitive details before data leaves your network.
Order is part of the meaning
When a pipeline lists several processors, the Collector applies them in exactly the order they are listed. The first processor in the list sees the data first, and its output feeds the second, and so on. Reversing two processors can change the result, or even undermine a safety feature.
Memory protection comes first
Placing the memory limiter at the start lets it refuse data early, before more work is spent on something the Collector cannot afford to hold.
Context and cleaning come next
Processors that add context, filter or redact work on individual items while they are still small and separate.
Batching comes last
Grouping works best once data is final, immediately before export, so that the bundles sent out already contain the finished items.
A widely used arrangement is memory protection first, then any cleaning or enrichment, and batching at the end. Treat this as a sensible default, and adjust it when a specific processor’s documentation recommends something different.
Problem
Listing processors in arbitrary order, for example batching before filtering, or placing the memory limiter at the end.
Why It’s Harmful
Batching first means filters work on bundles instead of items, and a memory limiter at the end cannot protect the earlier stages. The pipeline still starts, so the mistake can stay hidden until a busy day.
Correct Approach
Plan the order deliberately: protect, then enrich or clean, then batch. Re-read the order whenever a new processor is added.
6Exporters: The Trucks Carrying Data Out
An exporter takes finished telemetry and delivers it to its destination.
An exporter sends data out of the Collector. The destination might be a commercial monitoring service, an open-source backend, a message queue, a file on disk, the terminal screen, or even another Collector. As with receivers, each exporter entry has a type and a set of settings. For a network exporter, the settings usually include the destination address, security details such as certificates or tokens, and rules for timeouts, retries and queuing.
Exporters are delivery trucks, each with its own route and its own paperwork. One truck goes to the city warehouse, another to the regional depot, a third just drives the parcels to a local archive. You can run as many trucks as you like, and the same parcel can ride on more than one of them.
Resilience settings you will often see
Networks fail and backends have bad days. Many exporters therefore include settings that make delivery more dependable. These are worth knowing by name, because they appear again and again in real files.
Timeout
How long to wait for the destination to respond before giving up on one attempt.
Retry
Whether and how often to try again after a failure, and how long to wait between attempts.
Sending queue
A waiting area in memory where data sits until it can be delivered, smoothing over short outages and bursts.
TLS and authentication
Encryption and identity settings that protect data in transit and prove who is sending it.
Exporters you will meet often
| Kind of destination | Typical exporter | When it is used |
|---|---|---|
| Another OpenTelemetry-compatible endpoint | OTLP over gRPC or HTTP | Sending to a gateway Collector or to a backend that accepts the native protocol |
| Metrics backends | Prometheus-style exporters | Exposing metrics for a scraper, or writing them to a compatible store |
| Vendor services | Vendor-specific exporters | Delivering to a commercial observability platform in its preferred format |
| Local debugging | Debug exporter | Printing received telemetry to the console to check that data is flowing |
| Files and queues | File or message-queue exporters | Archiving data or handing it to another system for later processing |
When you are building a new configuration, add a console-printing exporter alongside your real one. Seeing items appear on screen is a quick, reliable proof that the door, the workers and the routing are all working before you worry about the destination.
A sending queue that has no sensible size limit can grow during an outage and use a great deal of memory. Pair queue settings with the memory-protection processor, and choose limits that match the machine you are running on.
7Connectors: Bridges Between Pipelines
A connector is a clever component that plays two roles at once.
A connector joins two pipelines together. In the first pipeline, it behaves like an exporter: data flows into it as the pipeline’s final step. In the second pipeline, it behaves like a receiver: it is where data enters. Whatever the connector emits on the receiving side may be the same data it was given, or something newly created from that data.
A connector is like a hand-over desk between two departments of a factory. The first department drops finished work onto the desk, and the second department picks it up from the same desk. Sometimes the desk simply passes the work along, and sometimes it turns it into something else, such as counting the items and handing over a tally instead.
What connectors make possible
Routing data to different places
A routing connector can look at each item and send it to one pipeline or another depending on a rule, such as the team that owns the service. Each target pipeline can then have its own processors and exporters.
Turning one signal into another
Some connectors read one signal type and produce a different one. For example, a connector can read traces and produce metrics, such as request counts and durations, so that you get metrics without adding new instrumentation to applications.
Copying data to several pipelines
A forwarding or fan-out style connector can send the same data into several pipelines, each treating it differently, for example one with heavy filtering and one that keeps everything.
Chaining stages for clarity
A long, complicated pipeline can be split into smaller pipelines that are joined by a connector, making each stage easier to understand and maintain.
flowchart LR
A["Traces pipeline: receiver, processors"] --> B["Connector (acts as exporter)"]
B --> C["Connector (acts as receiver)"]
C --> D["Metrics pipeline: processors, exporter"]
A rule about signals
A connector has an input signal type on its exporting side and an output signal type on its receiving side. These must match the pipelines it joins. A connector that turns traces into metrics must be placed as an exporter in a traces pipeline and as a receiver in a metrics pipeline. If the signal types do not match, the configuration is not valid.
Pipelines joined by connectors must not form a circle in which data could travel round forever. The Collector checks for this and refuses to start when it finds a cycle, but it is easier to design with a simple one-directional flow in mind from the start.
8Extensions: Helpful Services Beside the Data Path
Not everything the Collector does involves moving telemetry. Extensions cover the rest.
An extension adds a capability to the Collector that is not part of the receive, process and export flow. Extensions never sit inside a pipeline. They run alongside, offering services to the Collector itself or to its other components.
Extensions are the building’s services: the fire alarm, the security desk, the notice board at reception. They do not handle parcels, but the post office would be harder and riskier to run without them.
Health checking
Provides an address that orchestration tools can call to find out whether the Collector is alive and ready.
Authentication
Supplies credentials for outgoing connections, or checks credentials on incoming ones, so that components can reuse a shared definition.
Diagnostics
Offers profiling pages and live views of internal state, useful when investigating the performance of the Collector.
Persistent storage
Gives other components a place on disk to keep their state, so queues and progress can survive a restart.
Service discovery
Helps the Collector find targets automatically in dynamic environments instead of using a fixed list.
Extensions need to be listed, too
Just like other components, an extension is only a description until it is enabled. Extensions are enabled by listing them in the extensions list inside the service section. Interestingly, this list is separate from the pipelines, because extensions do not take part in the flow of data.
Some receivers and exporters point to an extension by name, for example to borrow a shared authentication definition or storage location. In that case the extension must be both defined and enabled, or the component that refers to it will fail to start.
9The Service Section: Where Everything Comes Together
The service section is the most important part of the file, because it decides what really runs.
The service section has three parts. Each answers a different question, and together they turn a collection of definitions into a working system.
Extensions
A list of the extensions to switch on, chosen from those defined in the extensions section.
Pipelines
The routes that data takes. Each pipeline names its receivers, processors and exporters.
Telemetry
Settings for the Collector’s own logs and metrics, so you can monitor the monitor.
flowchart TD
S["service"] --> X["extensions: list of enabled extensions"]
S --> P["pipelines: traces, metrics, logs"]
S --> T["telemetry: Collector's own logs and metrics"]
P --> P1["receivers list"]
P --> P2["processors list (ordered)"]
P --> P3["exporters list"]
Pipelines: the heart of the file
A pipeline is a complete route for one type of signal. It names which receivers feed it, which processors run on the data in what order, and which exporters deliver the result. Each pipeline belongs to exactly one signal type, so there are traces pipelines, metrics pipelines and logs pipelines. You may define as many pipelines as you need, including more than one for the same signal.
| Pipeline part | Required? | What it holds |
|---|---|---|
| Receivers | Yes | One or more receivers that bring data into this pipeline |
| Processors | No | An ordered list of processors applied between input and output |
| Exporters | Yes | One or more exporters that send out the final data |
Telemetry: watching the Collector itself
The Collector is also software that can go wrong, so it produces its own telemetry. The telemetry part of the service section controls how much the Collector says about itself: how detailed its own logs are, and how its own metrics are exposed. This is separate from the data flowing through pipelines. It is a way to answer questions such as how many items were received, how many were refused, and whether exports are failing.
A factory has production lines for the goods it makes, and it also has gauges on its own machines that show whether they are healthy. The pipelines are the production lines. The telemetry settings are the gauges on the machinery itself.
Make sure the Collector’s own metrics are collected and graphed. A Collector that quietly drops data because it is overloaded is a failure that nobody sees unless the Collector reports on itself.
10Naming Components: The Type and Name Pattern
The same kind of component can appear more than once, as long as each copy has its own name.
Every component in the file is identified by a label built from two pieces: its type and an optional name, joined by a slash. The type says what kind of component it is, such as an OTLP receiver or a batch processor. The name is a label you choose, which makes this particular copy distinct from other copies of the same type.
Think of a school with several teachers who all teach maths. Their job title, maths teacher, is the type. Their personal name tells you which one you mean. You can have as many maths teachers as you like, provided that each has a different name.
Why you would want more than one
Two backends of the same kind
You might send data to a production backend and to a test backend, both using the same exporter type but with different addresses and credentials. Two named copies of the exporter handle this neatly.
Different settings for different pipelines
A batch processor with small bundles suits urgent data, while another with larger bundles suits bulk data. Two named copies let each pipeline have the right behaviour.
Listening on several ports
You could run two copies of the same receiver type to accept data on different addresses, for instance one internal and one for a partner network.
| Identifier style | Meaning | Example idea |
|---|---|---|
| Type only | The default, unnamed instance of that type | The standard OTLP receiver |
| Type, slash, name | A distinct, named instance of that type | A second OTLP receiver called internal |
When a pipeline lists a component, it must use the full identifier, including the slash and name where there is one. A small spelling difference means the pipeline refers to something that was never defined, and the Collector will report an error.
Descriptive names such as production, staging or partner make a file much easier to read than numbers like 2 or 3. The name is free text for humans, so use it to leave a hint for the next person.
11Defined Versus Enabled: The Rule That Trips Everyone Up
Configuring a component and activating it are two different acts.
We have mentioned this idea several times, because it is the number one source of confusion. The Collector’s documentation states it plainly: configuring a receiver does not enable it. Receivers, processors, exporters and connectors are enabled only by being named inside a pipeline. Extensions are enabled by being listed in the service section’s extensions list. Anything defined but never referenced is simply ignored.
| Component | Defined in | Enabled by |
|---|---|---|
| Receiver | receivers section | Being listed in a pipeline’s receivers |
| Processor | processors section | Being listed in a pipeline’s processors |
| Exporter | exporters section | Being listed in a pipeline’s exporters |
| Connector | connectors section | Appearing in one pipeline’s exporters and another pipeline’s receivers |
| Extension | extensions section | Being listed in the service section’s extensions |
Define the component
Describe its type and settings in the matching top-level section.
Reference it in the service section
Add its identifier to a pipeline, or to the extensions list in the case of an extension.
Collector builds and starts it
On start-up, the Collector creates exactly the components that are referenced and connects them as described.
Problem
Adding a new receiver or exporter definition, restarting the Collector, and then wondering why nothing has changed.
Why It’s Harmful
The new definition was never added to a pipeline, so the Collector never created it. People lose hours checking addresses and networks when the cause is a missing line in the service section.
Correct Approach
Whenever you add or rename a component, make a second edit in the service section. Think of it as a two-step change: define, then enable.
Because unused definitions are harmless, teams sometimes keep a few extra components defined as ready-made options and switch them on by adding them to a pipeline. This is convenient, but it can also leave dead definitions that confuse readers, so remove what you no longer need.
12Pipelines in Depth: Fan-In, Fan-Out and Signal Types
A pipeline can take data from many doors and deliver it to many trucks.
Pipelines are more flexible than they first appear. They are not limited to one receiver and one exporter. Understanding how data behaves when several components are listed lets you design setups that are both simple and powerful.
Fan-in: several receivers, one pipeline
When a pipeline lists more than one receiver, data from all of them is merged into the same stream and then passes through the same processors. This is called fan-in. It is handy when the same kind of data arrives in several formats, for example traces from older applications in one format and from newer applications in another, but you want them cleaned and delivered in the same way.
Fan-out: one pipeline, several exporters
When a pipeline lists more than one exporter, the processed data is sent to every one of them. This is called fan-out. It lets you deliver the same data to a production backend and an archive, or to two different vendors during a migration. Each exporter has its own queue and retry behaviour, so a slow destination does not need to hold up the others in principle, although a very slow or failing one can still add pressure on shared resources.
flowchart LR
R1["Receiver A"] --> P["Processors in order"]
R2["Receiver B"] --> P
P --> E1["Exporter 1"]
P --> E2["Exporter 2"]
P --> E3["Exporter 3"]
Fan-in is several small streams flowing into one river. Fan-out is the same river splitting into several channels at a delta. Everything in the river passes the same bends in between, which are your processors.
One pipeline per signal type
A pipeline handles exactly one signal type. If you want traces, metrics and logs to travel through the Collector, you define at least one pipeline for each. Each uses receivers, processors and exporters that support that signal. A component such as the OTLP receiver may appear in all three, but a component that only understands metrics can only appear in metrics pipelines.
| Question | Answer |
|---|---|
| How many signal types can one pipeline carry? | Exactly one: traces, metrics or logs |
| Can the same receiver appear in several pipelines? | Yes, if it supports those signals |
| Can the same exporter appear in several pipelines? | Yes, if it supports those signals |
| Can I have several pipelines for the same signal? | Yes, with distinct names |
| Do pipelines share processors? | They can reference the same definition, but each pipeline gets its own working instance |
Naming pipelines
Pipelines follow the same type-and-name idea as components. A pipeline is identified by its signal type, optionally followed by a slash and a name. Having two traces pipelines, one called default and one called sensitive, for example, lets you give different treatments to different data while staying inside the rules.
When several pipelines mention the same processor, they use the same settings but run independent copies of it. Do not assume that two pipelines share a single batch or that a limit is shared between them. Each one counts on its own.
13Environment Variables, Secrets and Providers
A good configuration file avoids hard-coding values that change between machines or must stay secret.
Real configurations need values that differ between environments: an address that is different in testing and production, an access token that must never be written in a file that people share. The Collector lets you put placeholders in the file and fill them in when the Collector starts.
Environment variable expansion
An environment variable is a named value supplied by the operating system or the container platform to a running program. In a Collector file, you refer to one with a dollar sign, curly braces, and the word env followed by a colon and the variable’s name. At start-up, the Collector replaces the placeholder with the real value. You can also give a fallback value, which is used when the variable is not set. If you need a literal dollar sign in the file, you write it twice.
A form letter says, “Dear [name]”, and the system fills in the name when it prints each copy. Placeholders in a Collector file work the same way: the file stays the same, and the value is filled in for each environment.
Providers: other places to fetch values
The Collector fetches values through components called providers. The environment variable provider is the one most people meet first. Others can read the contents of a file or fetch a value from a web address. Each provider is selected by the word that comes before the colon in the placeholder. This keeps secrets in dedicated places, such as mounted files from a secrets manager, instead of in the configuration itself.
env
Reads the value of an environment variable, with an optional default if it is missing.
file
Reads content from a file. It can be used for a single secret value or to include a whole piece of configuration.
http and https
Fetches configuration from a web address, which allows central management of shared settings.
yaml
Lets you supply a small piece of configuration directly in a command-line option or placeholder.
Never paste passwords, tokens or keys directly into a configuration file that is stored in version control or shared with teammates. Use placeholders and supply the real values through the platform’s secrets mechanism.
Splitting configuration across several files
As configurations grow, a single huge file becomes hard to read. The Collector accepts more than one configuration file at start-up, and merges them into one. You provide each file with its own configuration option on the command line. Each file may be partial, but the combined result must form a complete, valid configuration.
A shared base file
Holds the settings that every environment uses, such as common receivers and standard processors.
Environment-specific files
Add or adjust settings for one place, such as the exporter address for production.
The Collector merges them
Later files take precedence over earlier ones where they overlap, and the merged result is validated as a whole.
Merging has specific rules about how maps and lists combine, and lists in particular may be replaced rather than extended. Always inspect the final merged result, using the inspection command described next, before relying on it in production.
14Validating and Inspecting a Configuration
Catch mistakes on your own machine instead of in the middle of an incident.
The Collector includes commands that check a configuration without running it. These are a great safety net, because they catch spelling errors, missing components, signal mismatches and other structural problems before anything is deployed.
validate
Reads the configuration, checks it against the components in your build, and reports problems. It does not start any data flow.
print-config
Shows the final configuration after merging files and expanding placeholders, so you can see what the Collector will really use. This feature has been labelled experimental in the documentation.
What validation typically catches
Unknown components
A component type that does not exist in your build, perhaps because of a spelling error or because it was not compiled in.
Undefined references
A pipeline that names a component that was never defined, or defined under a slightly different identifier.
Signal mismatches
A component used in a pipeline for a signal that it does not support.
Invalid settings
Values of the wrong kind or outside allowed limits, such as text where a number is expected.
Pipeline cycles
Connectors that would make data loop back into an earlier pipeline.
Add validation as a step in your delivery process, so that every change to a configuration file is checked before it can reach a running Collector. It takes seconds and prevents many outages.
A configuration can pass validation and still do the wrong thing, such as sending data to the wrong destination or placing processors in a poor order. Validation proves the file is well-formed, not that it matches your intent. Follow it with a test using real or sample data.
15Reading a Whole File Top to Bottom
Let us practise on a typical, small configuration, described in words so you can learn the reading routine.
Imagine a modest configuration for a service that sends traces, metrics and logs to one backend. In the file, you would see the following, in roughly this order.
Receivers section
One OTLP receiver that listens for gRPC and HTTP connections, so applications can send all three signals to a single door.
Processors section
A memory limiter to protect the Collector and a batch processor to bundle data for efficient delivery, plus perhaps a resource processor that stamps data with the environment name.
Exporters section
An OTLP exporter pointing at the backend’s address, with security settings, and maybe a debug exporter for temporary testing.
Extensions section
A health-check extension so the platform can tell whether the Collector is alive.
Service section
Lists the health-check extension, then defines three pipelines, one each for traces, metrics and logs. Each uses the OTLP receiver, the processors in the careful order, and the exporter. A telemetry part sets the Collector’s own log level.
flowchart LR
A["OTLP receiver"] --> B["memory limiter"]
B --> C["resource processor"]
C --> D["batch processor"]
D --> E["OTLP exporter to backend"]
D --> F["debug exporter (temporary)"]
A reading routine you can reuse
Jump to the service section
It is the plan that actually runs, so it tells you at once what matters in the file.
Read each pipeline left to right
Receivers, then processors in order, then exporters. Say the route out loud.
Look up each name above
For every identifier, find its definition and read the settings that tune it.
Spot the unused
Note any definitions that no pipeline mentions. They are inactive and may be leftovers.
16Agent and Gateway: Same Structure, Different Jobs
The file layout stays the same, but its contents change depending on where the Collector runs.
Teams commonly run the Collector in two roles. As an agent, it runs close to the applications, often on the same machine or alongside the application in the same group of containers. As a gateway, it runs as a central service that receives data from many agents and applications, and forwards it to the backends. Both roles use exactly the same six sections. What differs is which components are chosen.
| Aspect | Agent | Gateway |
|---|---|---|
| Where it runs | Next to the applications | As a shared central service |
| Typical receivers | OTLP from local applications, host metrics, log files | OTLP from agents and other services |
| Typical processors | Memory limiter, resource detection, batching | Memory limiter, filtering, sampling, redaction, batching |
| Typical exporters | OTLP to the gateway | Backend-specific exporters, possibly several |
| Main concern | Low overhead and local context | Central control, policy and scale |
flowchart LR
A["App + agent Collector"] --> G["Gateway Collector"]
B["App + agent Collector"] --> G
C["App + agent Collector"] --> G
G --> D["Backend 1"]
G --> E["Backend 2"]
Agents are the local post boxes on every street, and the gateway is the central sorting office. Both are post offices in the sense that they take, sort and send parcels, but the local boxes are small and quick, while the central office does the heavy sorting.
Advantages of Using Both
- Applications send to a nearby, fast destination
- Policy such as redaction and sampling lives in one place
- Backend credentials can be kept on the gateway only
- Local agents add machine context automatically
- Changes to backends do not touch every machine
Trade-offs to Consider
- More moving parts to deploy and monitor
- An extra network hop adds a little delay
- The gateway becomes a critical shared component
- Configurations must stay consistent between roles
17Security and Reliability Considerations
A Collector sits on the path of everything your systems report, so it deserves careful settings.
The configuration file is not only about functionality. It is also where you decide how safe and dependable the Collector will be. A few themes appear in nearly every careful setup.
Limit who can connect
Keep receivers on local addresses unless remote access is genuinely needed, and add authentication for any receiver that listens on a network.
Encrypt traffic
Use TLS on receivers and exporters that cross network boundaries, so telemetry cannot be read or altered on the way.
Redact sensitive data
Use processors to remove personal or secret information before it leaves your network.
Protect memory
Always include a memory limiter in production pipelines and keep it first in the processor list.
Size queues sensibly
Set queue and retry limits that fit the machine, so an outage does not turn into a memory problem.
Expose health and self-metrics
Use a health extension and the Collector’s own metrics so failures are noticed quickly.
Diagnostic extensions can reveal a lot about the Collector’s internals. Bind them to local addresses, and do not expose them to untrusted networks.
Real-world pattern: the cautious production setup
A typical production gateway keeps its backend credentials in environment variables supplied by a secrets system, encrypts every network hop, puts the memory limiter first, batches last, exposes a health check for the platform, and keeps the Collector’s own metrics in the same monitoring system it feeds, with an alert for refused or dropped data.
18Common Mistakes and How to Avoid Them
Almost everyone makes these mistakes once. Knowing them in advance saves hours.
Problem
Defining a component and forgetting to add it to a pipeline or to the extensions list.
Why It’s Harmful
The Collector starts without complaint, but the component never exists. Data does not arrive, or does not leave, and the cause is hard to see.
Correct Approach
Make every change in two places: the definition and the service section. Review the service section as the final step of every edit.
Problem
Exposing receivers on every network address by default, without authentication or encryption.
Why It’s Harmful
Anyone who can reach the machine can send data to the Collector, flood it, or use it as a stepping stone. Telemetry may also include sensitive details that travel unprotected.
Correct Approach
Listen on local addresses unless remote access is needed, and then add TLS and authentication. Restrict access with network rules as well.
Problem
Running without a memory limiter, or running it with settings copied from a different environment.
Why It’s Harmful
A traffic spike or a slow backend can make the Collector use all available memory, and the operating system then stops it, losing the data it held.
Correct Approach
Always include a memory limiter first in the processor list, and set its limits relative to the memory actually available to the Collector.
Problem
Embedding secrets such as tokens and passwords directly in the file.
Why It’s Harmful
Files are copied, committed and shared. A secret that lives in a file is eventually seen by people and systems that should never have it.
Correct Approach
Use placeholders that read values from environment variables or mounted files supplied by a secrets system.
Problem
Leaving a console-printing debug exporter enabled in production pipelines.
Why It’s Harmful
It writes every item to the Collector’s output, which consumes processing time and storage, and may expose sensitive details in logs that many people can read.
Correct Approach
Use the debug exporter only while testing, and remove it from production pipelines before release.
Copying a large example configuration from the internet brings along components you do not need and settings tuned for another situation. Start small, add only what you can explain, and read the documentation for each component you include.
19Best Practices Checklist
A short list to keep beside you whenever you write or review a configuration.
Do
- Read and design from the service section first
- Order processors deliberately: protect, enrich or clean, then batch
- Use descriptive names for repeated components
- Validate every change before deploying it
- Inspect the final merged configuration when using several files
- Use placeholders for secrets and environment-specific values
- Collect the Collector’s own metrics and alert on drops
- Keep configurations in version control and review changes
Do Not
- Assume that a definition means the component is active
- Expose receivers or diagnostic extensions to untrusted networks
- Paste secrets into files
- Leave unused definitions to mislead later readers
- Rely on defaults for memory and queue sizes in production
- Copy large examples without understanding them
- Skip testing because validation passed
Start with the smallest working pipeline
One receiver, one exporter, and a debug view. Confirm that data flows end to end.
Add protection and efficiency
Insert the memory limiter at the front and the batch processor at the end, then test again.
Add the processors you actually need
Context, filtering or redaction, one at a time, placing each carefully in the order.
Harden for production
Add encryption, authentication, health checks, self-monitoring and secure handling of secrets.
Remove the scaffolding
Delete temporary debug components and unused definitions, validate, and store the final version.
20Frequently Asked Questions
Quick answers to the questions beginners ask most often.
Six: receivers, processors, exporters, connectors, extensions and service. The first five define components, and the service section enables them and connects them into pipelines.
The service section is required, and a useful configuration needs at least one receiver and one exporter in a pipeline. Processors, connectors and extensions are optional.
Configuring a component does not enable it. Check that the receiver is listed in at least one pipeline inside the service section, and that the pipeline’s signal type is supported by that receiver.
Yes. Processors run in the order they are listed in the pipeline. A common arrangement is memory protection first, then enrichment or cleaning, and batching last.
Not in the same way. Several receivers merge into one stream, and data is sent to every listed exporter. Order matters for processors, not for these two lists.
It is an identifier that lets you define several instances of the same component type. The type says what it is, and the name tells copies apart.
An exporter sends data out of the Collector. A connector sends data out of one pipeline and into another, acting as an exporter on one side and a receiver on the other.
No. Extensions are enabled through the extensions list in the service section, because they provide side services rather than handling telemetry data.
Use placeholders that read from environment variables or files supplied by your platform’s secrets mechanism, and keep the real values out of version control.
Yes. Provide each file as its own configuration option. The files are merged, and the combined result must be a complete, valid configuration.
Use the Collector’s validate command to check structure and references, and the print-config command to see the final merged result. Then test with sample data, because a valid file can still be wrong.
The structure is identical, but the contents differ. Agents usually collect locally and forward, while gateways apply central policy such as filtering and redaction before delivering to backends.
21Summary and Key Takeaways
A Collector configuration file is a plan with six parts. Receivers bring data in, processors change it, exporters send it out, connectors join pipelines together, and extensions add side services. The service section is where the plan becomes real: it lists the enabled extensions, defines the pipelines that route each signal from receivers through ordered processors to exporters, and configures the Collector’s own telemetry. Components can be defined several times using a type-and-name identifier, but only the ones referenced in the service section are ever created. With placeholders for environment-specific values, validation before deployment, careful processor order, and sensible security and memory settings, the same simple structure scales from a laptop experiment to a production gateway.
Key Takeaways
- Six sections, one pattern — receivers, processors, exporters, connectors and extensions define components, while service enables and connects them.
- Defined is not enabled — a component only runs when it is referenced in a pipeline, or in the extensions list for extensions.
- Pipelines carry one signal each — traces, metrics and logs travel through separate pipelines made of receivers, ordered processors and exporters.
- Processor order is meaning — protect memory first, enrich or clean next, and batch last.
- Identifiers allow reuse — the type-and-name pattern lets you define several instances of the same component with different settings.
- Keep configuration flexible and safe — use placeholders and providers for environment values and secrets, and merge files carefully.
- Validate, inspect, then test — checks catch structural mistakes, but only real data proves the file does what you intended.