docs/victorialogs: clarify usage of -rule.defaultRuleType=vlogs

User experience suggests that examples shouldn't have `-rule.defaultRuleType=vlogs` set,
as it may confuse users who run vmalert with their existing rules or only use
rules from examples for testing purposes.

This change is supposed to remove the confusion by removing `-rule.defaultRuleType=vlogs`
from default recommendations and explcitily specifying `type` on group level in examples.

Signed-off-by: hagen1778 <roman@victoriametrics.com>
This commit is contained in:
hagen1778 2024-11-06 14:55:58 +01:00
parent 0390d58a34
commit a5f1764171
No known key found for this signature in database
GPG key ID: E92986095E0DD614

View file

@ -21,20 +21,19 @@ _Note: This page provides only integration instructions for vmalert and Victoria
## Quick Start ## Quick Start
Run vmalert with `-rule.defaultRuleType=vlogs` cmd-line flag. Run vmalert with the following settings:
```sh ```sh
./bin/vmalert -rule=alert.rules \ # Path to the files or http url with alerting and/or recording rules in YAML format. ./bin/vmalert -rule=alert.rules \ # Path to the files or http url with alerting and/or recording rules in YAML format.
-datasource.url=http://localhost:9428 \ # VictoriaLogs address. -datasource.url=http://localhost:9428 \ # VictoriaLogs address.
-rule.defaultRuleType=vlogs \ # Set default rules type to VictoriaLogs.
-notifier.url=http://localhost:9093 \ # AlertManager URL (required if alerting rules are used) -notifier.url=http://localhost:9093 \ # AlertManager URL (required if alerting rules are used)
-remoteWrite.url=http://localhost:8428 \ # Remote write compatible storage to persist rules and alerts state info (required for recording rules) -remoteWrite.url=http://localhost:8428 \ # Remote write compatible storage to persist rules and alerts state info (required for recording rules)
-remoteRead.url=http://localhost:8428 \ # Prometheus HTTP API compatible datasource to restore alerts state from -remoteRead.url=http://localhost:8428 \ # Prometheus HTTP API compatible datasource to restore alerts state from
``` ```
> See the full list of configuration flags and their descriptions in [configuration](#configuration) section. > Note: By default, vmalert assumes configured rules have `prometheus` type and will validate them accordingly. For rules in [LogsQL](https://docs.victoriametrics.com/victorialogs/logsql/) specify `type: vlogs` on [Group level](#groups). Or set `-rule.defaultRuleType=vlogs` cmd-line flag to automatically apply `type: vlogs` to all groups.
> Each `-rule` file may contain arbitrary number of [groups](https://docs.victoriametrics.com/vmalert/#groups). Each `-rule` file may contain arbitrary number of [groups](https://docs.victoriametrics.com/vmalert/#groups).
See examples in [Groups](#groups) section. See examples in [Groups](#groups) section. See the full list of configuration flags and their descriptions in [configuration](#configuration) section.
With configuration example above, vmalert will perform the following interactions: With configuration example above, vmalert will perform the following interactions:
![vmalert](vmalert_victorialogs.webp) ![vmalert](vmalert_victorialogs.webp)
@ -97,6 +96,7 @@ Examples:
```yaml ```yaml
groups: groups:
- name: ServiceLog - name: ServiceLog
type: vlogs
interval: 5m interval: 5m
rules: rules:
- alert: HasErrorLog - alert: HasErrorLog
@ -105,6 +105,7 @@ groups:
description: "Service {{$labels.service}} generated {{$labels.errorLog}} error logs in the last 5 minutes" description: "Service {{$labels.service}} generated {{$labels.errorLog}} error logs in the last 5 minutes"
- name: ServiceRequest - name: ServiceRequest
type: vlogs
interval: 5m interval: 5m
rules: rules:
- alert: TooManyFailedRequest - alert: TooManyFailedRequest
@ -119,6 +120,7 @@ Examples:
```yaml ```yaml
groups: groups:
- name: RequestCount - name: RequestCount
type: vlogs
interval: 5m interval: 5m
rules: rules:
- record: nginxRequestCount - record: nginxRequestCount
@ -139,6 +141,7 @@ For instance, the rule below will be evaluated every 5 minutes, and will return
```yaml ```yaml
groups: groups:
- name: Requests - name: Requests
type: vlogs
interval: 5m interval: 5m
rules: rules:
- alert: TooManyFailedRequest - alert: TooManyFailedRequest
@ -152,6 +155,7 @@ but will calculate result over the logs from the last 10 minutes.
```yaml ```yaml
groups: groups:
- name: Requests - name: Requests
type: vlogs
interval: 5m interval: 5m
rules: rules:
- alert: TooManyFailedRequest - alert: TooManyFailedRequest
@ -192,6 +196,7 @@ This expression can also be used in recording rules as follows:
```yaml ```yaml
groups: groups:
- name: requestDuration - name: requestDuration
type: vlogs
interval: 5m interval: 5m
rules: rules:
- record: requestDurationQuantile - record: requestDurationQuantile