2023-07-14 12:12:23 +02:00
---
2023-10-05 10:40:55 +02:00
weight: 6
2024-07-29 14:29:15 +02:00
title: FAQ
2023-07-14 12:12:23 +02:00
menu:
docs:
2023-10-04 15:46:28 +02:00
identifier: "victorialogs-faq"
2023-07-14 12:12:23 +02:00
parent: "victorialogs"
2023-10-05 10:40:55 +02:00
weight: 6
2024-01-19 17:02:20 +01:00
title: FAQ
2023-07-14 12:12:23 +02:00
aliases:
- /VictoriaLogs/FAQ.html
2024-03-25 10:09:15 +01:00
- /VictoriaLogs/faq.html
2023-07-14 12:12:23 +02:00
---
2023-07-12 09:24:52 +02:00
## What is the difference between VictoriaLogs and Elasticsearch (OpenSearch)?
Both Elasticsearch and VictoriaLogs allow ingesting structured and unstructured logs
and performing fast full-text search over the ingested logs.
Elasticsearch and OpenSearch are designed as general-purpose databases for fast full-text search over large set of documents.
They aren't optimized specifically for logs. This results in the following issues, which are resolved by VictoriaLogs:
- High RAM usage
- High disk space usage
- Non-trivial index setup
2024-10-01 11:52:24 +02:00
- Inability to select more than 10K matching log lines in a single query with default configs
2023-07-12 09:24:52 +02:00
2023-07-12 10:10:32 +02:00
VictoriaLogs is optimized specifically for logs. So it provides the following features useful for logs, which are missing in Elasticsearch:
2023-07-12 09:24:52 +02:00
- Easy to setup and operate. There is no need in tuning configuration for optimal performance or in creating any indexes for various log types.
2024-10-01 11:52:24 +02:00
Just run VictoriaLogs on the most suitable hardware, ingest logs into it via [supported data ingestion protocols ](https://docs.victoriametrics.com/victorialogs/data-ingestion/ )
and get the best available performance out of the box.
2023-07-14 19:52:11 +02:00
- Up to 30x less RAM usage than Elasticsearch for the same workload.
- Up to 15x less disk space usage than Elasticsearch for the same amounts of stored logs.
2024-10-01 11:52:24 +02:00
- Ability to work efficiently with hundreds of terabytes of logs on a single node.
- Easy to use query language optimized for typical log analysis tasks - [LogsQL ](https://docs.victoriametrics.com/victorialogs/logsql/ ).
2024-05-25 00:30:58 +02:00
- Fast full-text search over all the [log fields ](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model ) out of the box.
- Good integration with traditional command-line tools for log analysis. See [these docs ](https://docs.victoriametrics.com/victorialogs/querying/#command-line ).
2023-07-12 09:24:52 +02:00
## What is the difference between VictoriaLogs and Grafana Loki?
Both Grafana Loki and VictoriaLogs are designed for log management and processing.
2024-05-25 00:30:58 +02:00
Both systems support [log stream ](https://docs.victoriametrics.com/victorialogs/keyconcepts/#stream-fields ) concept.
2023-07-12 09:24:52 +02:00
VictoriaLogs and Grafana Loki have the following differences:
2024-10-01 11:52:24 +02:00
- VictoriaLogs is much easier to setup and operate than Grafana Loki. There is no need in non-trivial tuning -
it works great with default configuration.
- VictoriaLogs performs typical full-text search queries up to 1000x faster than Grafana Loki.
- Grafana Loki doesn't support log fields with many unique values (aka high cardinality labels) such as `user_id` , `trace_id` or `ip` .
It consumes huge amounts of RAM and slows down significantly when logs with high-cardinality fields are ingested into it.
2023-07-12 09:24:52 +02:00
See [these docs ](https://grafana.com/docs/loki/latest/best-practices/ ) for details.
2024-10-01 11:52:24 +02:00
VictoriaLogs supports high-cardinality [log fields ](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model )
out of the box without any additional configuration. It automatically indexes all the ingested log fields,
so fast full-text search over any log field works without issues.
2023-07-12 09:24:52 +02:00
- Grafana Loki provides very inconvenient query language - [LogQL ](https://grafana.com/docs/loki/latest/logql/ ).
This query language is hard to use for typical log analysis tasks.
2024-08-06 15:41:04 +02:00
VictoriaLogs provides easy to use query language for typical log analysis tasks - [LogsQL ](https://docs.victoriametrics.com/victorialogs/logsql/ ).
2023-07-12 09:24:52 +02:00
2024-10-01 11:52:24 +02:00
- VictoriaLogs usually needs less RAM and storage space than Grafana Loki for the same amounts of logs.
2023-07-12 09:24:52 +02:00
## What is the difference between VictoriaLogs and ClickHouse?
ClickHouse is an extremely fast and efficient analytical database. It can be used for logs storage, analysis and processing.
VictoriaLogs is designed solely for logs. VictoriaLogs uses [similar design ideas as ClickHouse ](#how-does-victorialogs-work ) for achieving high performance.
2024-10-01 11:52:24 +02:00
- ClickHouse is good for logs if you know the set of [log fields ](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model )
and the expected query types beforehand. Then you can create a table with a column per each log field, and use the most optimal settings for the table -
sort order, partitioning and indexing - for achieving the maximum possible storage efficiency and query performance.
2023-07-12 09:24:52 +02:00
2024-10-01 11:52:24 +02:00
If the expected log fields or the expected query types aren't known beforehand, or if they may change over any time,
then ClickHouse can still be used, but its' efficiency may suffer significantly depending on how you design the database schema for log storage.
2023-07-12 09:24:52 +02:00
VictoriaLogs works optimally with any log types out of the box - structured, unstructured and mixed.
2024-05-25 00:30:58 +02:00
It works optimally with any sets of [log fields ](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model ),
2023-07-12 09:24:52 +02:00
which can change in any way across different log sources.
- ClickHouse provides SQL dialect with additional analytical functionality. It allows performing arbitrary complex analytical queries
over the stored logs.
2023-07-12 10:10:32 +02:00
VictoriaLogs provides easy to use query language with full-text search specifically optimized
2024-05-25 00:30:58 +02:00
for log analysis - [LogsQL ](https://docs.victoriametrics.com/victorialogs/logsql/ ).
2024-10-01 11:52:24 +02:00
LogsQL is usually easier to use than SQL for typical log analysis tasks, while some
2023-07-12 10:10:32 +02:00
non-trivial analytics may require SQL power.
2023-07-12 09:24:52 +02:00
2024-05-25 00:30:58 +02:00
- VictoriaLogs accepts logs from popular log shippers out of the box - see [these docs ](https://docs.victoriametrics.com/victorialogs/data-ingestion/ ).
2023-07-12 09:24:52 +02:00
ClickHouse needs an intermediate applications for converting the ingested logs into `INSERT` SQL statements for the particular database schema.
This may increase the complexity of the system and, subsequently, increase its' maintenance costs.
## How does VictoriaLogs work?
2024-05-25 00:30:58 +02:00
VictoriaLogs accepts logs as [JSON entries ](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model ).
2024-10-01 11:52:24 +02:00
Then it stores log fields into a distinct data block. E.g. values for the same log field across multiple log entries
are stored in a single data block. This allows reading data blocks only for the needed fields during querying.
2023-07-12 09:24:52 +02:00
2023-07-12 10:10:32 +02:00
Data blocks are compressed before being saved to persistent storage. This allows saving disk space and improving query performance
2023-07-12 09:24:52 +02:00
when it is limited by disk read IO bandwidth.
Smaller data blocks are merged into bigger blocks in background. Data blocks are limited in size. If the size of data block exceeds the limit,
then it is split into multiple blocks of smaller sizes.
Every data block is processed in an atomic manner during querying. For example, if the data block contains at least a single value,
which needs to be processed, then the whole data block is unpacked and read at once. Data blocks are processed in parallel
on all the available CPU cores during querying. This allows scaling query performance with the number of available CPU cores.
This architecture is inspired by [ClickHouse architecture ](https://clickhouse.com/docs/en/development/architecture ).
On top of this, VictoriaLogs employs additional optimizations for achieving high query performance:
- It uses [bloom filters ](https://en.wikipedia.org/wiki/Bloom_filter ) for skipping blocks without the given
2024-05-25 00:30:58 +02:00
[word ](https://docs.victoriametrics.com/victorialogs/logsql/#word-filter ) or [phrase ](https://docs.victoriametrics.com/victorialogs/logsql/#phrase-filter ).
2023-07-12 09:24:52 +02:00
- It uses custom encoding and compression for fields with different data types.
2024-10-01 11:52:24 +02:00
For example, it encodes IP addresses int 4 bytes. Custom fields' encoding reduces data size on disk and improves query performance.
2024-05-25 00:30:58 +02:00
- It physically groups logs for the same [log stream ](https://docs.victoriametrics.com/victorialogs/keyconcepts/#stream-fields )
2024-10-01 11:52:24 +02:00
close to each other in the storage. This improves compression ratio, which helps reducing disk space usage. This also improves query performance
2024-05-25 00:30:58 +02:00
by skipping blocks for unneeded streams when [stream filter ](https://docs.victoriametrics.com/victorialogs/logsql/#stream-filter ) is used.
- It maintains sparse index for [log timestamps ](https://docs.victoriametrics.com/victorialogs/keyconcepts/#time-field ),
which allow improving query performance when [time filter ](https://docs.victoriametrics.com/victorialogs/logsql/#time-filter ) is used.
2024-06-28 02:01:46 +02:00
## How to export logs from VictoriaLogs?
Just send the query with the needed [filters ](https://docs.victoriametrics.com/victorialogs/logsql/#filters )
to [`/select/logsql/query` ](https://docs.victoriametrics.com/victorialogs/querying/#querying-logs ) - VictoriaLogs will return
the requested logs as a [stream of JSON lines ](https://jsonlines.org/ ). It is recommended specifying [time filter ](https://docs.victoriametrics.com/victorialogs/logsql/#time-filter )
for limiting the amounts of exported logs.