Configuration
The section describes how to configure Yandex Unified Agent. Before getting started, explore the basic concepts used in agent configuration.
Configuration files
Specify the required Unified Agent settings in the config.yml file. This file is provided as a parameter at agent startup. You can import additional configuration files into config.yml using the import directive.
The configuration file may contain the following sections:
routes: Description of delivery routes.channels: Description of named channels.pipes: Description of named pipes.storages: Description of storages.status,main_thread_pool,agent_log,system: Sections containing service information.
To provide the configuration file, specify its path in the --config parameter:
/usr/bin/unified_agent --config /etc/yandex/unified_agent/config.yml
When you install Unified Agent from the deb package, the basic configuration file, /etc/yandex/unified_agent/config.yml, is automatically set and provided to the --config parameter.
Importing configuration files
-
Create additional YAML configuration files in the
/etc/yandex/unified_agent/conf.ddirectory. -
Import the additional YAML files using the main
config.ymlfile:import: - /etc/yandex/unified_agent/conf.d/*.ymlThe files from the
/etc/yandex/unified_agent/conf.ddirectory are imported in alphabetical order.
The import directive value is a string or array of strings; each string is expanded using the globimport directives, and within each directive, in lexicographic order of file names.
When importing configuration files, the following rules apply:
- The
statusandmain_thread_poolsections are pulled from the last imported file. - The
channels,storages, andpipessections are specified as lists. New items are added to the end of the list or replaced if there is already an item with the samename. - The
routessection is specified as a list. New items are added to the end of the list.
You can also add the import directive to the files you are importing. To do so, specify only absolute paths under import. Relative paths start from the agent's startup directory.
Note
We do not recommend using import in nested files as this makes your configuration bulky.
If the configuration import loops, Unified Agent will terminate with an error. You can find the error details in the agent logs. The maximum recursion depth is 100. If the imported file contains errors, the full path to the original file containing the erroneous node will be output.
Output and validation of the final configuration
To validate the agent settings, run the command:
unified_agent --config /etc/yandex/unified_agent/config.yml check-config
If the validation is successful, once all imports are complete, the agent will output the final configuration version to stdout and the null return code.
If the validation fails, the agent will output configuration errors to stderr and a non-null return code:
unified_agent --config console_to_lb.yml check-config
yaml-cpp: error at line 10, column 3: unrecognized field [status_port]
Configuration directives
Below you can find the configuration sections and parameters of different Unified Agent components. For optional parameters, the values given in the examples are the default ones.
Examples
For configuration examples, see Working with metrics.