diff --git a/changelog.d/validate_skip_healthchecks.enhancement.md b/changelog.d/validate_skip_healthchecks.enhancement.md new file mode 100644 index 0000000000000..5ba1ef5f60ff6 --- /dev/null +++ b/changelog.d/validate_skip_healthchecks.enhancement.md @@ -0,0 +1,5 @@ +New Option `--skip-healthchecks` for `vector validate` validates config +including VRL, but skips health checks for sinks. + +Useful to validate configuration before deploying it remotely. +authors: MartinEmrich diff --git a/src/validate.rs b/src/validate.rs index cc3e336b1d403..a06ea9a9bf5ce 100644 --- a/src/validate.rs +++ b/src/validate.rs @@ -21,6 +21,10 @@ pub struct Opts { #[arg(long)] pub no_environment: bool, + /// Disables health checks during validation. + #[arg(long)] + pub skip_healthchecks: bool, + /// Fail validation on warnings that are probably a mistake in the configuration /// or are recommended to be fixed. #[arg(short, long)] @@ -178,8 +182,7 @@ async fn validate_environment(opts: &Opts, config: &Config, fmt: &mut Formatter) } else { return false; }; - - validate_healthchecks(opts, config, &diff, &mut pieces, fmt).await + opts.skip_healthchecks || validate_healthchecks(opts, config, &diff, &mut pieces, fmt).await } async fn validate_components( diff --git a/website/content/en/docs/administration/validating.md b/website/content/en/docs/administration/validating.md index e00ae9e210cec..bfdaec1f98189 100644 --- a/website/content/en/docs/administration/validating.md +++ b/website/content/en/docs/administration/validating.md @@ -55,6 +55,18 @@ These environment checks can be disabled using the [`--no-environment`][no_envir vector validate --no-environment /etc/vector/vector.yaml ``` +#### Skipping health checks + +To validate the vector configuration even if the health-checked endpoints are not reachable +(for example, from a local workstation), but still run all the other environment checks, use +the [`--skip-healthchecks`][skip_healthchecks] flag: + +```bash +vector validate --skip-healthchecks /etc/vector/vector.yaml +``` + +**Note:** The configured `data_dir` must still be writeable. + [components]: /components [no_environment]: /docs/reference/cli/#validate-no-environment [sinks]: /sinks diff --git a/website/cue/reference/cli.cue b/website/cue/reference/cli.cue index 3f13cb4908f33..33b5ef448e062 100644 --- a/website/cue/reference/cli.cue +++ b/website/cue/reference/cli.cue @@ -413,6 +413,12 @@ cli: { checks and health checks """ } + "skip-healthchecks": { + _short: "ne" + description: """ + Disables health checks during validation. + """ + } "deny-warnings": { _short: "d" description: "Fail validation on warnings"