Caution
Grafana Alloy is the new name for our distribution of the OTel collector. Grafana Agent has been deprecated and is in Long-Term Support (LTS) through October 31, 2025. Grafana Agent will reach an End-of-Life (EOL) on November 1, 2025. 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.
The convert command
The convert
command converts a supported configuration format to Grafana Agent Flow River format.
Usage
Usage:
AGENT_MODE=flow grafana-agent convert [FLAG ...] FILE_NAME
grafana-agent-flow convert [FLAG ...] FILE_NAME
Replace the following:
FLAG
: One or more flags that define the input and output of the command.FILE_NAME
: The Grafana Agent configuration file.
If the FILE_NAME
argument isn’t provided or if the FILE_NAME
argument is
equal to -
, convert
converts the contents of standard input. Otherwise,
convert
reads and converts the file from disk specified by the argument.
There are several different flags available for the convert
command. You can use the --output
flag to write the contents of the converted configuration to a specified path. You can use the --report
flag to generate a diagnostic report. The --bypass-errors
flag allows you to bypass any errors generated during the file conversion.
The command fails if the source configuration has syntactically incorrect configuration or can’t be converted to Grafana Agent Flow River format.
The following flags are supported:
--output
,-o
: The filepath and filename where the output is written.--report
,-r
: The filepath and filename where the report is written.--source-format
,-f
: Required. The format of the source file. Supported formats: prometheus, promtail, static.--bypass-errors
,-b
: Enable bypassing errors when converting.--extra-args
,e
: Extra arguments from the original format used by the converter.
Defaults
Grafana Agent Flow defaults are managed as follows:
- If a provided source configuration value matches a Grafana Agent Flow default value, the property is left off the output.
- If a non-provided source configuration value default matches a Grafana Agent Flow default value, the property is left off the output.
- If a non-provided source configuration value default doesn’t match a Grafana Agent Flow default value, the default value is included in the output.
Errors
Errors are defined as non-critical issues identified during the conversion
where an output can still be generated. These can be bypassed using the
--bypass-errors
flag.
Prometheus
Using the --source-format=prometheus
will convert the source config from
Prometheus v2.45
to Grafana Agent Flow configuration.
This includes Prometheus features such as scrape_config, relabel_config, metric_relabel_configs, remote_write, and many supported *_sd_configs. Unsupported features in a source configuration result in errors.
Refer to Migrate from Prometheus to Grafana Agent Flow for a detailed migration guide.
Promtail
Using the --source-format=promtail
will convert the source configuration from
Promtail v2.8.x
to Grafana Agent Flow configuration.
Nearly all Promtail features are supported and can be converted to Grafana Agent Flow configuration.
If you have unsupported features in a source configuration, you will receive errors when you convert to a flow configuration. The converter will also raise warnings for configuration options that may require your attention.
Refer to Migrate from Promtail to Grafana Agent Flow for a detailed migration guide.
Static
Using the --source-format=static
will convert the source configuration from a
Grafana Agent Static configuration to a Grafana Agent Flow configuration.
Include --extra-args
for passing additional command line flags from the original format.
For example, --extra-args="-enable-features=integrations-next"
will convert a Grafana Agent Static
integrations-next
configuration to a Grafana Agent Flow configuration. You can also
expand environment variables with --extra-args="-config.expand-env"
. You can combine multiple command line
flags with a space between each flag, for example --extra-args="-enable-features=integrations-next -config.expand-env"
.
If you have unsupported features in a Static mode source configuration, you will receive errors when you convert to a Flow mode configuration. The converter will also raise warnings for configuration options that may require your attention.
Refer to Migrate from Grafana Agent Static to Grafana Agent Flow for a detailed migration guide.