validate
The validate command validates an Alloy configuration file or directory path.
Usage
alloy validate [<FLAG> ...] <PATH_NAME>Replace the following:
<FLAG>: One or more flags that define the input and output of the command.<PATH_NAME>: Required. The Alloy configuration file or directory path.
If the configuration file is valid, the validate command returns a zero exit code.
If the configuration file is invalid, the command returns a non-zero exit code and prints diagnostics generated during validation to stderr.
If you provide a directory path for the <PATH_NAME>, Alloy finds *.alloy files, ignoring nested directories, and loads them as a single configuration source.
The following flags are supported:
--config.format: Specifies the source file format. Supported formats:alloy,otelcol,prometheus,promtail, andstatic(default"alloy").--config.bypass-conversion-errors: Enable bypassing errors during conversion (defaultfalse).--config.extra-args: Extra arguments from the original format used by the converter.--stability.level: The minimum permitted stability level of functionality. Supported values:experimental,public-preview, andgenerally-available(default"generally-available").--feature.community-components.enabled: Enable community components (defaultfalse).
Note
When you validate the Alloy configuration, you must set the
--stability.leveland--feature.community-components.enabledarguments to the same values you want to use when you run Alloy.
Limitations
Validation is limited in scope. It currently checks for:
- Syntax errors.
- Missing components.
- Component name conflicts.
- Required properties are set.
- Unknown properties.
- Foreach blocks.
- Declare blocks.