Caution
Grafana Agent has reached End-of-Life (EOL) on November 1, 2025. Agent is no longer receiving vendor support and will no longer receive security or bug fixes. Current users of Agent Static mode, Agent Flow mode, and Agent Operator should proceed with migrating to Grafana Alloy. If you have already migrated to Alloy, no further action is required. Read more about why we recommend migrating to Grafana Alloy.
Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
Configuration language concepts
The Grafana Agent Flow configuration language, River, refers to the language used in configuration files that define and configure components to run.
prometheus.scrape "default" {
targets = [{
"__address__" = "demo.robustperception.io:9090",
}]
forward_to = [prometheus.remote_write.default.receiver]
}
prometheus.remote_write "default" {
endpoint {
url = "http://localhost:9009/api/prom/push"
}
}River is designed with the following requirements in mind:
- Fast: The configuration language must be fast so the component controller can quickly evaluate changes.
- Simple: The configuration language must be easy to read and write to minimize the learning curve.
- Debuggable: The configuration language must give detailed information when there’s a mistake in the configuration file.
Attributes
You use Attributes to configure individual settings.
Attributes always take the form of ATTRIBUTE_NAME = ATTRIBUTE_VALUE.
The following example shows how to set the log_level attribute to "debug".
log_level = "debug"Expressions
You use expressions to compute the value of an attribute.
The simplest expressions are constant values like "debug", 32, or [1, 2, 3, 4].
River supports complex expressions, for example:
- Referencing the exports of components:
local.file.password_file.content - Mathematical operations:
1 + 2,3 * 4,(5 * 6) + (7 + 8) - Equality checks:
local.file.file_a.content == local.file.file_b.content - Calling functions from River’s standard library:
env("HOME")retrieves the value of theHOMEenvironment variable.
You can use expressions for any attribute inside a component definition.
Referencing component exports
The most common expression is to reference the exports of a component, for example, local.file.password_file.content.
You form a reference to a component’s exports by merging the component’s name (for example, local.file),
label (for example, password_file), and export name (for example, content), delimited by a period.
Blocks
You use Blocks to configure components and groups of attributes. Each block can contain any number of attributes or nested blocks.
prometheus.remote_write "default" {
endpoint {
url = "http://localhost:9009/api/prom/push"
}
}The preceding example has two blocks:
prometheus.remote_write "default": A labeled block which instantiates aprometheus.remote_writecomponent. The label is the string"default".endpoint: An unlabeled block inside the component that configures an endpoint to send metrics to. This block sets theurlattribute to specify the endpoint.
More information
Refer to Configuration language for more information about River.



