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
Copy file name to clipboardExpand all lines: cmd/mcp-victorialogs/resources/vm/docs/victorialogs/FAQ.md
+31-1Lines changed: 31 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -243,7 +243,37 @@ or [Grafana plugin for VictoriaLogs](https://docs.victoriametrics.com/victorialo
243
243
then make sure the selected time range covers the last day. Otherwise, the query above returns
244
244
results on the intersection of the last day and the selected time range.
245
245
246
-
See [why the log field occupies a lot of disk space](https://docs.victoriametrics.com/victorialogs/faq/#why-the-log-field-occupies-a-lot-of-disk-space).
246
+
See also:
247
+
248
+
-[Why the log field occupies a lot of disk space](https://docs.victoriametrics.com/victorialogs/faq/#why-the-log-field-occupies-a-lot-of-disk-space).
249
+
-[How to detect log streams, which occupy the most of disk space](https://docs.victoriametrics.com/victorialogs/faq/#how-to-determine-which-log-streams-occupy-the-most-of-disk-space).
250
+
251
+
## How to determine which log streams occupy the most of disk space?
252
+
253
+
[Run](https://docs.victoriametrics.com/victorialogs/querying/) the following [LogsQL](https://docs.victoriametrics.com/victorialogs/logsql/) query
254
+
based on [`block_stats` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#block_stats-pipe):
255
+
256
+
```logsql
257
+
_time:1d
258
+
| block_stats
259
+
| stats by (_stream)
260
+
sum(values_bytes) as values_bytes,
261
+
sum(bloom_bytes) as bloom_bytes
262
+
| math
263
+
(values_bytes+bloom_bytes) as total_bytes
264
+
| first 10 (total_bytes desc)
265
+
```
266
+
267
+
This query returns top 10 [log streams](https://docs.victoriametrics.com/victorialogs/keyconcepts/#stream-fields),
268
+
which occupy the most of disk space across the logs ingested during the last day. The occupied disk space
269
+
is returned in the `total_bytes` field.
270
+
271
+
If you use [VictoriaLogs web UI](https://docs.victoriametrics.com/victorialogs/querying/#web-ui)
272
+
or [Grafana plugin for VictoriaLogs](https://docs.victoriametrics.com/victorialogs/integrations/grafana/),
273
+
then make sure the selected time range covers the last day. Otherwise, the query above returns
274
+
results on the intersection of the last day and the selected time range.
275
+
276
+
See also [how to detect log fields, which occupy the most of disk space](https://docs.victoriametrics.com/victorialogs/faq/#how-to-determine-which-log-fields-occupy-the-most-of-disk-space).
247
277
248
278
## Why the log field occupies a lot of disk space?
Copy file name to clipboardExpand all lines: cmd/mcp-victorialogs/resources/vm/docs/victorialogs/LogsQL.md
+26-2Lines changed: 26 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1666,7 +1666,8 @@ LogsQL supports the following pipes:
1666
1666
1667
1667
### block_stats pipe
1668
1668
1669
-
`<q> | block_stats`[pipe](https://docs.victoriametrics.com/victorialogs/logsql/#pipes) returns the following stats for each block processed by `<q>`[query](https://docs.victoriametrics.com/victorialogs/logsql/#query-syntax):
1669
+
`<q> | block_stats`[pipe](https://docs.victoriametrics.com/victorialogs/logsql/#pipes) returns the following stats for each field in every data block
1670
+
processed by `<q>`[query](https://docs.victoriametrics.com/victorialogs/logsql/#query-syntax):
1670
1671
1671
1672
-`field` - [field](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model) name
1672
1673
-`rows` - the number of rows at the given `field`
@@ -1675,9 +1676,12 @@ LogsQL supports the following pipes:
1675
1676
-`bloom_bytes` - on-disk size of bloom filter data for the given `field`
1676
1677
-`dict_bytes` - on-disk size of the dictionary data for the given `field`
1677
1678
-`dict_items` - the number of unique values in the dictionary for the given `field`
1678
-
-`part_path` - the path to the data part where the block is stored
1679
+
-`_stream` - the [log stream](https://docs.victoriametrics.com/victorialogs/keyconcepts/#stream-fields) for the given `field`
1680
+
-`part_path` - the path to the data part where the field data is stored
1679
1681
1680
1682
The `block_stats` pipe is needed mostly for debugging purposes.
1683
+
See, for example, [how to detect which log field occupies the most of the disk space](https://docs.victoriametrics.com/victorialogs/faq/#how-to-determine-which-log-fields-occupy-the-most-of-disk-space),
1684
+
or [how to detect which log stream occupies the most of the disk space](https://docs.victoriametrics.com/victorialogs/faq/#how-to-determine-which-log-streams-occupy-the-most-of-disk-space).
1681
1685
1682
1686
See also:
1683
1687
@@ -4532,6 +4536,11 @@ over logs for the last 5 minutes:
4532
4536
_time:5m | stats max(duration) max_duration
4533
4537
```
4534
4538
4539
+
The `max(some_field)` function works with string values for the `some_field`, so it returns an empty string value if `some_field`
4540
+
is missing in some of the processed logs according to [VictoriaLogs data model](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model).
4541
+
Use `max(some_field) if (some_field:*) as min_value_without_empty_string` syntax for filtering out empty string values.
4542
+
See [conditional stats docs](https://docs.victoriametrics.com/victorialogs/logsql/#stats-with-additional-filters) for more details.
4543
+
4535
4544
It is possible to calculate the maximum value across all the fields with common prefix via `max(prefix*)` syntax.
4536
4545
4537
4546
[`row_max`](https://docs.victoriametrics.com/victorialogs/logsql/#row_max-stats) function can be used for obtaining other fields with the maximum duration.
@@ -4555,6 +4564,11 @@ over logs for the last 5 minutes:
4555
4564
_time:5m | stats median(duration) median_duration
4556
4565
```
4557
4566
4567
+
The `median(some_field)` function works with string values for the `some_field`, so it returns an empty string value if `some_field`
4568
+
is missing in some of the processed logs according to [VictoriaLogs data model](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model).
4569
+
Use `median(some_field) if (some_field:*) as min_value_without_empty_string` syntax for filtering out empty string values.
4570
+
See [conditional stats docs](https://docs.victoriametrics.com/victorialogs/logsql/#stats-with-additional-filters) for more details.
4571
+
4558
4572
It is possible to calculate the median across all the fields with common prefix via `median(prefix*)` syntax.
4559
4573
4560
4574
See also:
@@ -4574,6 +4588,11 @@ over logs for the last 5 minutes:
4574
4588
_time:5m | stats min(duration) min_duration
4575
4589
```
4576
4590
4591
+
The `min(some_field)` function works with string values for the `some_field`, so it returns an empty string value if `some_field`
4592
+
is missing in some of the processed logs according to [VictoriaLogs data model](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model).
4593
+
Use `min(some_field) if (some_field:*) as min_value_without_empty_string` syntax for filtering out empty string values.
4594
+
See [conditional stats docs](https://docs.victoriametrics.com/victorialogs/logsql/#stats-with-additional-filters) for more details.
4595
+
4577
4596
It is possible to find the minimum across all the fields with common prefix via `min(prefix*)` syntax.
4578
4597
4579
4598
[`row_min`](https://docs.victoriametrics.com/victorialogs/logsql/#row_min-stats) function can be used for obtaining other fields with the minimum duration.
@@ -4601,6 +4620,11 @@ _time:5m | stats
4601
4620
quantile(0.99, request_duration_seconds) p99
4602
4621
```
4603
4622
4623
+
The `quantile(phi, some_field)` function works with string values for the `some_field`, so it returns an empty string value if `some_field`
4624
+
is missing in some of the processed logs according to [VictoriaLogs data model](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model).
4625
+
Use `quantile(phi, some_field) if (some_field:*) as min_value_without_empty_string` syntax for filtering out empty string values.
4626
+
See [conditional stats docs](https://docs.victoriametrics.com/victorialogs/logsql/#stats-with-additional-filters) for more details.
4627
+
4604
4628
It is possible to calculate the quantile across all the fields with common prefix via `quantile(phi, prefix*)` syntax.
Copy file name to clipboardExpand all lines: cmd/mcp-victorialogs/resources/vm/docs/victorialogs/README.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,8 +60,7 @@ to [Grafana plugin playground for VictoriaLogs](https://play-grafana.victoriamet
60
60
The only option is increasing the limit on [the number of open files in the OS](https://medium.com/@muhammadtriwibowo/set-permanently-ulimit-n-open-files-in-ubuntu-4d61064429a).
61
61
- The recommended filesystem is `ext4`, the recommended persistent storage is [persistent HDD-based disk on GCP](https://cloud.google.com/compute/docs/disks/#pdspecs),
62
62
since it is protected from hardware failures via internal replication and it can be [resized on the fly](https://cloud.google.com/compute/docs/disks/add-persistent-disk#resize_pd).
63
-
If you plan to store more than 1TB of data on `ext4` partition or plan extending it to more than 16TB,
64
-
then the following options are recommended to pass to `mkfs.ext4`:
63
+
If you plan to store more than 1TB of data on `ext4` partition, then the following options are recommended to pass to `mkfs.ext4`:
65
64
66
65
```sh
67
66
mkfs.ext4 ... -O 64bit,huge_file,extent -T huge
@@ -195,6 +194,11 @@ VictoriaLogs accepts logs with timestamps in the time range `[now-retentionPerio
195
194
where `retentionPeriod` is the value for the `-retentionPeriod` command-line flag and `futureRetention` is the value for the `-futureRetention` command-line flag.
196
195
Sometimes it is needed to reject logs older than the given age. This can be achieved by passing `-maxBackfillAge=d` command-line flag to VictoriaLogs,
197
196
where `d` is the maximum age of logs to be accepted. Older logs are rejected and a sample of these logs is put into VictoriaLogs output logs, so they could be investigated.
197
+
For example, the following command starts VictoriaLogs, which rejects logs older than 1 hour:
Start the first [`vlstorage` node](https://docs.victoriametrics.com/victorialogs/cluster/#architecture), which accepts incoming requests at the port `9491` and stores the ingested logs in the `victoria-logs-data-1` directory:
Copy file name to clipboardExpand all lines: cmd/mcp-victorialogs/resources/vm/docs/victorialogs/querying/README.md
+24-6Lines changed: 24 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -452,11 +452,17 @@ 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
458
-
The `<t>` arg can contain values in [any supported format](https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#timestamp-formats).
459
-
If `<t>` is missing, then it equals to the current time.
461
+
The [`row_any`](https://docs.victoriametrics.com/victorialogs/logsql/#row_any-stats), [`row_min`](https://docs.victoriametrics.com/victorialogs/logsql/#row_min-stats)
462
+
and [`row_max`](https://docs.victoriametrics.com/victorialogs/logsql/#row_max-stats) stats functions create labels instead of metrics.
463
+
464
+
Additional labels can be created from metrics via [`format` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#format-pipe).
465
+
Additional metrics can be created from the existing metrics via [`math` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#math-pipe).
460
466
461
467
For example, the following command returns the number of logs per each `level`[field](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model)
462
468
across logs over `2024-01-01` day by UTC:
@@ -509,6 +515,7 @@ Below is an example JSON output returned from this endpoint:
509
515
```
510
516
511
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/).
512
519
513
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.
530
537
The stats is returned in the format compatible with [Prometheus querying API](https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries).
531
538
532
-
The `<query>` must contain [`stats` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#stats-pipe). The calculated stats is converted into metrics
533
-
with labels from `by(...)` clause of the `| stats by(...)` pipe.
534
-
535
539
The `<start>` and `<end>` args can contain values in [any supported format](https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#timestamp-formats).
536
540
If `<start>` is missing, then it equals to the minimum timestamp across logs stored in VictoriaLogs.
537
541
If `<end>` is missing, then it equals to the maximum timestamp across logs stored in VictoriaLogs.
@@ -543,6 +547,19 @@ Note: The `/select/logsql/stats_query_range` endpoint
543
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.
544
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.
545
549
550
+
The `<query>` must contain [`stats` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#stats-pipe). The calculated stats is converted into metrics
551
+
with labels from `by(...)` clause of the `| stats by(...)` pipe.
552
+
553
+
The [`row_any`](https://docs.victoriametrics.com/victorialogs/logsql/#row_any-stats), [`row_min`](https://docs.victoriametrics.com/victorialogs/logsql/#row_min-stats)
554
+
and [`row_max`](https://docs.victoriametrics.com/victorialogs/logsql/#row_max-stats) stats functions create labels instead of metrics.
555
+
556
+
Additional labels can be created from metrics via [`format` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#format-pipe).
557
+
Additional metrics can be created from the existing metrics via [`math` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#math-pipe).
558
+
559
+
It may be useful to use [`running_stats`](https://docs.victoriametrics.com/victorialogs/logsql/#running_stats-pipe)
560
+
and [`total_stats`](https://docs.victoriametrics.com/victorialogs/logsql/#total_stats-pipe) pipes for calculating running and total stats over the stats
561
+
returned by the [`stats` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#stats-pipe).
562
+
546
563
For example, the following command returns the number of logs per each `level`[field](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model)
547
564
across logs over `2024-01-01` day by UTC with 6-hour granularity:
548
565
@@ -612,6 +629,7 @@ Below is an example JSON output returned from this endpoint:
612
629
```
613
630
614
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/).
615
633
616
634
The `/select/logsql/stats_query_range` returns the following additional HTTP response headers:
617
635
@@ -1098,7 +1116,7 @@ VictoriaLogs provides the following options to limit resource usage by the execu
1098
1116
## Web UI
1099
1117
1100
1118
VictoriaLogs provides Web UI for logs [querying](https://docs.victoriametrics.com/victorialogs/logsql/) and exploration
1101
-
at `http://localhost:9428/select/vmui`. Try [VictoriaLogs web UI demo playground](https://play-vmlogs.victoriametrics.com/).
1119
+
at `http://localhost:9428/select/vmui/`. Try [VictoriaLogs web UI demo playground](https://play-vmlogs.victoriametrics.com/).
1102
1120
1103
1121
There are three modes of displaying query results:
Copy file name to clipboardExpand all lines: cmd/mcp-victorialogs/resources/vm/docs/victorialogs/security-and-lb.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -229,7 +229,7 @@ However, user `admin` needs to set the required `AccountID` or `ProjectID` heade
229
229
230
230
In Grafana, you need to create a separate data source for each tenant and user, an example of such an address is: `http://vmauth:8427/my-account/mobile-logs`.
231
231
Using the configuration above, you do not need to set the tenant in the data source settings because vmauth will set it.
232
-
Each tenant will have `vmui` at the address `/select/vmui`, for example: `http://vmauth:8427/my-account/mobile-logs/select/vmui`.
232
+
Each tenant will have `vmui` at the address `/select/vmui/`, for example: `http://vmauth:8427/my-account/mobile-logs/select/vmui/`.
233
233
234
234
If you want to restrict users by only one of the fields `AccountID` or `ProjectID`,
235
235
it is enough to not specify the corresponding field in the `headers` section.
0 commit comments