You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs/victorialogs/querying/README.md: group the description for the time-based query args at /select/logsql/stats_query and /select/logsql/stats_query_range docs
Previously the description for `time`, `start`, `end` and `step` query args was split into two parts
with the description for the `query` query arg in the middle. This complicated reading the docs.
Copy file name to clipboardExpand all lines: docs/victorialogs/querying/README.md
+16-14Lines changed: 16 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -452,6 +452,9 @@ VictoriaLogs provides `/select/logsql/stats_query?query=<query>&time=<t>` HTTP e
452
452
for the given [`query`](https://docs.victoriametrics.com/victorialogs/logsql/) at the given timestamp `t`
453
453
in the format compatible with [Prometheus querying API](https://prometheus.io/docs/prometheus/latest/querying/api/#instant-queries).
454
454
455
+
The `<t>` arg can contain values in [any supported format](https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#timestamp-formats).
456
+
If `<t>` is missing, then it equals to the current time.
457
+
455
458
The `<query>` must contain [`stats` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#stats-pipe). The calculated stats is converted into metrics
456
459
with labels from `by(...)` clause of the `| stats by(...)` pipe.
457
460
@@ -461,9 +464,6 @@ and [`row_max`](https://docs.victoriametrics.com/victorialogs/logsql/#row_max-st
461
464
Additional labels can be created from metrics via [`format` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#format-pipe).
462
465
Additional metrics can be created from the existing metrics via [`math` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#math-pipe).
463
466
464
-
The `<t>` arg can contain values in [any supported format](https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#timestamp-formats).
465
-
If `<t>` is missing, then it equals to the current time.
466
-
467
467
For example, the following command returns the number of logs per each `level`[field](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model)
468
468
across logs over `2024-01-01` day by UTC:
469
469
@@ -515,6 +515,7 @@ Below is an example JSON output returned from this endpoint:
515
515
```
516
516
517
517
The `/select/logsql/stats_query` API is useful for generating Prometheus-compatible alerts and calculating recording rules results.
518
+
It is used by [vmalert](https://docs.victoriametrics.com/victorialogs/vmalert/).
518
519
519
520
The `/select/logsql/stats_query` returns the following additional HTTP response headers:
for the given [`query`](https://docs.victoriametrics.com/victorialogs/logsql/) on the given `[start ... end)` time range with the given `step` interval.
536
537
The stats is returned in the format compatible with [Prometheus querying API](https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries).
537
538
539
+
The `<start>` and `<end>` args can contain values in [any supported format](https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#timestamp-formats).
540
+
If `<start>` is missing, then it equals to the minimum timestamp across logs stored in VictoriaLogs.
541
+
If `<end>` is missing, then it equals to the maximum timestamp across logs stored in VictoriaLogs.
542
+
543
+
The `<step>` arg can contain values in [the format specified here](https://docs.victoriametrics.com/victorialogs/logsql/#stats-by-time-buckets).
544
+
If `<step>` is missing, then it equals to `1d` (one day).
545
+
546
+
Note: The `/select/logsql/stats_query_range` endpoint
547
+
relies on `_time` field for time bucketing and therefore does not allow any pipe to change or remove the `_time` before the `| stats ...` pipe.
548
+
In contrast, queries passed to [`/select/logsql/stats_query`](https://docs.victoriametrics.com/victorialogs/querying/#querying-log-stats) can include any pipes before the `| stats ...` pipe, including pipes that modify or remove the `_time` field.
549
+
538
550
The `<query>` must contain [`stats` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#stats-pipe). The calculated stats is converted into metrics
539
551
with labels from `by(...)` clause of the `| stats by(...)` pipe.
540
552
@@ -548,17 +560,6 @@ It may be useful to use [`running_stats`](https://docs.victoriametrics.com/victo
548
560
and [`total_stats`](https://docs.victoriametrics.com/victorialogs/logsql/#total_stats-pipe) pipes for calculating running and total stats over the stats
549
561
returned by the [`stats` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#stats-pipe).
550
562
551
-
The `<start>` and `<end>` args can contain values in [any supported format](https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#timestamp-formats).
552
-
If `<start>` is missing, then it equals to the minimum timestamp across logs stored in VictoriaLogs.
553
-
If `<end>` is missing, then it equals to the maximum timestamp across logs stored in VictoriaLogs.
554
-
555
-
The `<step>` arg can contain values in [the format specified here](https://docs.victoriametrics.com/victorialogs/logsql/#stats-by-time-buckets).
556
-
If `<step>` is missing, then it equals to `1d` (one day).
557
-
558
-
Note: The `/select/logsql/stats_query_range` endpoint
559
-
relies on `_time` field for time bucketing and therefore does not allow any pipe to change or remove the `_time` before the `| stats ...` pipe.
560
-
In contrast, queries passed to [`/select/logsql/stats_query`](https://docs.victoriametrics.com/victorialogs/querying/#querying-log-stats) can include any pipes before the `| stats ...` pipe, including pipes that modify or remove the `_time` field.
561
-
562
563
For example, the following command returns the number of logs per each `level`[field](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model)
563
564
across logs over `2024-01-01` day by UTC with 6-hour granularity:
564
565
@@ -628,6 +629,7 @@ Below is an example JSON output returned from this endpoint:
628
629
```
629
630
630
631
The `/select/logsql/stats_query_range` API is useful for generating Prometheus-compatible graphs in Grafana.
632
+
It is used by [Grafana plugin for VictoriaLogs](https://docs.victoriametrics.com/victorialogs/integrations/grafana/).
631
633
632
634
The `/select/logsql/stats_query_range` returns the following additional HTTP response headers:
0 commit comments