Skip to content

Commit

Permalink
enhancement(administration config): New --skip-healthchecks option fo…
Browse files Browse the repository at this point in the history
…r vector validate (#19691)

* New --skip-healthchecks option for vector validate

Runs full validation including VRL remaps, but skips health check
connection attempts to remote sinks.

* Spelling fix

* Documentation suggestions by @maycmlee

---------

Co-authored-by: Jesse Szwedko <[email protected]>
  • Loading branch information
MartinEmrich and jszwedko authored Feb 8, 2024
1 parent 0e6cf3e commit 1825220
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
5 changes: 5 additions & 0 deletions changelog.d/validate_skip_healthchecks.enhancement.md
Original file line number Diff line number Diff line change
@@ -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
7 changes: 5 additions & 2 deletions src/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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(
Expand Down
12 changes: 12 additions & 0 deletions website/content/en/docs/administration/validating.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions website/cue/reference/cli.cue
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 1825220

Please sign in to comment.