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 is not 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 config 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 config has syntactically incorrect configuration or cannot 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.
Defaults
Flow Defaults are managed as follows:
- If a provided source config value matches a Flow default value, the property is left off the Flow output.
- If a non-provided source config value default matches a Flow default value, the property is left off the Flow output.
- If a non-provided source config value default doesn’t match a Flow default value, the Flow default value is included in the Flow 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 config.
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 config 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 config.
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
Grafana Agent Static mode to Flow mode configuration.
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 Grafana Agent from Static mode to Flow mode for a detailed migration guide.