Estimated time: 45 minutes.
Three special fields: _msg, _time, _stream
Why: Every log entry in VictoriaLogs consists of a message field _msg, a timestamp _time, and a stream identifier _stream together with _stream_id (key concepts).
The remaining fields (e.g. app_name, hostname, level) are ordinary fields, created when the log is parsed. When it receives RFC 5424 syslog, VictoriaLogs splits out these fields automatically.
Understanding the three special fields determines how you write LogsQL: word filters run on _msg, time filters use _time, and grouping by source uses _stream.
When it breaks: Without a valid _time, a log is assigned its arrival time instead of the time it was generated; time-range queries (_time:5m) then return skewed results.
Multi-protocol ingestion
Why: VictoriaLogs accepts logs through many paths: syslog, Elasticsearch _bulk, Loki push, OpenTelemetry, JSON stream, journald (data ingestion).
This lab uses the syslog path: enable the -syslog.listenAddr.tcp flag on victoria-logs, then have rsyslog forward the local logs to it. Each protocol maps fields in its own way.
Choosing the protocol that matches the log sources you already have (rsyslog/journald on Linux, Vector/Fluent Bit in containers) saves pipeline rework later.
When it breaks: Sending the wrong format to the wrong port (e.g. pushing JSON to the syslog port) leaves logs unparsed or fields empty.
LogsQL — filter, then pipe
Why: LogsQL consists of a filter part that selects log lines, followed by transformation pipes chained with | (LogsQL).
Filters include word filters on _msg, field:value, _stream:{...}, and time filters such as _time:5m. Common pipes: | stats count() by (field), | sort by (_time), | limit N.
The pipe model lets you combine filtering and statistics in a single line that reads left to right.
When it breaks: Applying SQL/Elasticsearch syntax to LogsQL makes the query fail with a syntax error or return 0 results without a clear error message.
_stream & stream fields
Why: A stream is a group of logs that share the same set of stream fields; VictoriaLogs stores and compresses logs per stream,
so queries that filter by _stream are very fast (stream fields).
Stream fields should be stable labels with few distinct values, such as app_name and hostname. For syslog logs, VictoriaLogs already puts these fields into _stream.
A good stream design keeps the number of streams small, saves RAM, and speeds up both ingest and queries.
When it breaks: Putting highly variable fields (request_id, ip) into stream fields causes high cardinality: the number of streams balloons, RAM grows, and ingest slows down.
Columnar storage, high compression
Why: VictoriaLogs stores logs in a column-oriented model within each stream and compresses them heavily to reduce disk usage (VictoriaLogs overview).
This layout is optimized for filtering and statistics queries over large log sets, unlike the document model of Elasticsearch.
Operators care about this when estimating disk space and when comparing log storage costs against other solutions.
When it breaks: Placing -storageDataPath on a small or full partition stops ingestion; you need to monitor the disk space where the data is stored.
Single-node and cluster
Why: The single-node edition is one victoria-logs binary that handles ingest, storage, and queries — enough for most workloads (quickstart).
The cluster edition splits three roles: vlinsert (receives ingest), vlstorage (storage), and vlselect (queries) — to scale horizontally (cluster).
Start with single-node; move to cluster when one node can no longer handle the log volume or when you need to separate ingest and query resources.
When it breaks: Deploying a cluster before you need one adds operational complexity without any extra benefit.
In real deployments: Single-node suits labs and moderate volumes; use a cluster (vlinsert/vlstorage/vlselect) when you need to scale out horizontally with log volume.
rsyslog (already running on most Linux systems) reads system logs and uses the omfwd module to push them to VictoriaLogs' syslog port in RFC 5424 format.
This is an ingest path that needs no extra collector.
The RSYSLOG_SyslogProtocol23Format template produces exactly the RFC 5424 framing that VictoriaLogs can parse (syslog ingestion).
After this step, every log that passes through rsyslog has a copy flowing into VictoriaLogs.
*.* action(type="omfwd" target="127.0.0.1" port="5410" protocol="tcp" template="RSYSLOG_SyslogProtocol23Format")
Observe with:
systemctl status rsyslog; cat /etc/rsyslog.d/50-victorialogs.conf
Enabling the -syslog.listenAddr.tcp=:5410 flag makes victoria-logs open the syslog receiving port;
the -httpListenAddr=:9428 flag opens the HTTP port for queries and the UI (syslog ingestion).
When parsing RFC 5424, VictoriaLogs produces the fields app_name, hostname, proc_id, severity, facility, and maps severity to level (info/notice/warning/error...).
These fields go into _stream or become ordinary fields, ready for LogsQL. The snippet below excerpts the key flags from the ExecStart line of the systemd unit; the full unit file is in Hands-on 1.
ExecStart=/usr/local/bin/victoria-logs \
-storageDataPath=/var/lib/victoria-logs \
-httpListenAddr=:9428 \
-syslog.listenAddr.tcp=:5410
Observe with:
ss -ltn | grep -E ':9428|:5410'
Every log entry is tied to a _stream (e.g. {app_name="sshd",hostname="web1"}) and a _time.
VictoriaLogs stores the fields by column and compresses them heavily within the scope of a stream (key concepts).
As a result, filtering by _stream and by _time touches only the relevant data instead of scanning everything. This is why queries by source plus time range are usually very fast.
# Count all logs received
curl -s -G 'http://localhost:9428/select/logsql/query' --data-urlencode 'query=* | stats count()'
Observe with:
curl -s -G 'http://localhost:9428/select/logsql/query' --data-urlencode 'query=* | stats count()'
The /select/logsql/query endpoint takes a query parameter holding a LogsQL expression and returns results as JSON, one log per line (querying).
The same endpoint also serves the built-in UI vmui at /select/vmui for visual querying.
Use --data-urlencode with curl to pass queries containing special characters without escaping them yourself.
curl -s -G 'http://localhost:9428/select/logsql/query' \
--data-urlencode 'query=hello'
Observe with:
Open http://<host>:9428/select/vmui in a browser
A bare word filter such as error matches a substring in _msg — so a log with app_name="demo" whose message does not contain "demo" will not match demo.
To filter by field use level:error or app_name:nginx; to filter by source use _stream:{app_name="demo"} (LogsQL filters).
Choosing the right type of filter is the difference between "0 results" and "exactly the set of logs you are looking for".
# word filter on _msg
curl -s -G '.../select/logsql/query' --data-urlencode 'query=error'
# field filter
curl -s -G '.../select/logsql/query' --data-urlencode 'query=level:error'
# stream filter by source
curl -s -G '.../select/logsql/query' --data-urlencode 'query=_stream:{app_name="demo"}'
Observe with:
Compare the results of the three queries above
The | stats count() by (field) pipe counts logs grouped by field; chain | sort by (...) and | limit N to order and trim the results (stats pipe).
On a real server, * | stats by (level) count() shows the distribution of log levels (lots of info, few errors) — a quick way to assess system health.
Pipes let you turn raw logs into aggregate numbers right inside the query.
curl -s -G '.../select/logsql/query' \
--data-urlencode 'query=* | stats by (level) count() | sort by (count) desc'
Observe with:
Cross-check the count for each level/app_name
Wrong: VictoriaLogs is a scaled-down Elasticsearch — you query it with the Query DSL and open it with Kibana.
Right: VictoriaLogs is queried with its own LogsQL. Elasticsearch compatibility exists only at the log-ingestion layer (the _bulk API), not at the query layer.
VictoriaLogs accepts logs over many protocols, including the Elasticsearch bulk API, so it can replace ES at the ingest stage (data ingestion: Elasticsearch).
The storage layer is column-oriented, not a Lucene-style inverted index; the query layer uses LogsQL —
a chain of a filter followed by transformation pipes (LogsQL), not the JSON Query DSL of Elasticsearch.
The practical consequence: you do not plug Kibana into VictoriaLogs; you view logs through the built-in UI vmui at /select/vmui or through the VictoriaLogs datasource in Grafana.
Wrong: Each _stream is like an Elasticsearch index — so create lots of streams to categorize logs neatly.
Right: A _stream is the set of logs that share the same "stream fields" (similar to Loki labels).
Choosing highly variable fields as stream fields causes an explosion in the number of streams and slows down ingest.
A stream is identified by the set of stream fields chosen at ingest time; each combination of values of those fields forms a separate stream (key concepts: stream fields).
If you use a highly variable field such as request_id or user_id as a stream field, the number of streams grows to nearly the number of log lines — known as high cardinality — which increases RAM usage and reduces speed.
In practice you should pick stable fields with few distinct values, such as app_name and hostname, as stream fields, and leave everything else as ordinary fields.
This also determines how you write _stream:{...} filters.
Wrong: LogsQL is written like SQL (SELECT ... WHERE ...) or like Prometheus' PromQL.
Right: LogsQL is a chain of pipes: one filter expression, followed by pipes such as stats, sort, limit joined with the | character. PromQL/MetricsQL is for metrics, not logs.
A LogsQL query starts with a filter expression (which selects the log lines), then chains pipes that transform the result with the | character (LogsQL pipes).
A bare word filter (e.g. error) matches on the _msg field; to filter by field use field:value; to filter by source use _stream:{...}; for statistics use | stats count() by (...).
If you are used to Prometheus, keep the two clearly apart: VictoriaMetrics + MetricsQL is for metrics, while VictoriaLogs + LogsQL is for logs — the same ecosystem, but two different query languages.
10 minutes
VictoriaLogs is released from its own repo, VictoriaMetrics/VictoriaLogs (separate from VictoriaMetrics core).
The single-node edition is one binary that runs ingest, storage, and queries.
This lab installs it as a binary running under systemd (no Docker); the archive contains just one file, victoria-logs-prod (quickstart).
# 1. Download, extract, check the version
cd /tmp
curl -fsSL -O https://github.com/VictoriaMetrics/VictoriaLogs/releases/download/v1.50.0/victoria-logs-linux-amd64-v1.50.0.tar.gz
tar xzf victoria-logs-linux-amd64-v1.50.0.tar.gz
./victoria-logs-prod --version
# 2. Install the binary, create a system user and the data directory
sudo install -m 0755 victoria-logs-prod /usr/local/bin/victoria-logs
sudo useradd --system --no-create-home --shell /usr/sbin/nologin victorialogs
sudo mkdir -p /var/lib/victoria-logs
sudo chown victorialogs:victorialogs /var/lib/victoria-logs
# 3. Write the systemd unit
sudo tee /etc/systemd/system/victorialogs.service >/dev/null <<'EOF'
[Unit]
Description=VictoriaLogs single-node
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=victorialogs
Group=victorialogs
ExecStart=/usr/local/bin/victoria-logs \
-storageDataPath=/var/lib/victoria-logs \
-retentionPeriod=30d \
-httpListenAddr=:9428 \
-syslog.listenAddr.tcp=:5410
Restart=on-failure
RestartSec=5
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
EOF
# 4. Load the unit, enable and start it, then verify
sudo systemctl daemon-reload
sudo systemctl enable --now victorialogs
systemctl is-active victorialogs
ss -ltn | grep -E ':9428|:5410'
curl -s http://localhost:9428/health
-retentionPeriod=30d keeps logs for 30 days (the default is only 7 days); adjust it to your disk capacity (retention).
1. Download and extract the linux-amd64 binary (v1.50.0), then check the version.
The binary is victoria-logs-prod; --version prints the tag v1.50.0 (e.g. victoria-logs-...-tags-v1.50.0-...).
2. Put the binary at /usr/local/bin/victoria-logs and create the systemd unit with the flags -httpListenAddr=:9428 -syslog.listenAddr.tcp=:5410, then enable --now.
systemctl is-active victorialogs → active; ss -ltn shows 0.0.0.0:9428 and 0.0.0.0:5410 in LISTEN state.
Analysis
Observation: After startup, both port 9428 (HTTP) and port 5410 (syslog TCP) are open.
Mechanism: One binary serves ingest (syslog), storage, and the HTTP API/UI at the same time — a hallmark of the single-node edition.
Takeaway: For moderate volumes, single-node is enough; split into a cluster only when you need to scale.
Troubleshooting:
systemctl reports the service failing right at start: Check journalctl -u victorialogs: it is usually because -storageDataPath is not writable or the port is already taken.
8 minutes
rsyslog uses the omfwd module to push local logs to VictoriaLogs' syslog port in RFC 5424.
The RSYSLOG_SyslogProtocol23Format template is the RFC 5424 framing that VictoriaLogs can parse (syslog ingestion).
echo '*.* action(type="omfwd" target="127.0.0.1" port="5410" protocol="tcp" template="RSYSLOG_SyslogProtocol23Format")' | sudo tee /etc/rsyslog.d/50-victorialogs.conf && sudo systemctl restart rsyslog
1. Add the forwarding config, restart rsyslog, and generate test logs with logger -t demo "hello victorialogs" and logger -t demo -p user.err "simulated error connection refused to db".
rsyslog is active; the two log lines with app_name=demo are pushed over almost instantly (the err line → level=error).
2. Query by source: curl -s -G 'http://localhost:9428/select/logsql/query' --data-urlencode 'query=_stream:{app_name="demo"}'.
It returns JSON with the 2 demo log lines, each having _msg, _time, _stream, app_name, hostname, level.
Analysis
Observation: The syslog entries appear with app_name="demo", hostname, and level already split out.
Mechanism: VictoriaLogs parses RFC 5424 and maps severity → level, putting app_name/hostname into _stream.
Takeaway: A bare word filter matches _msg; to filter by source you must use _stream:{app_name="..."}.
Troubleshooting:
The query returns nothing even though logs were sent: Check whether the logs arrived at all with query=* | stats count(); if it is 0, look at the rsyslog forwarding and port 5410; remember that a word filter only matches _msg.
6 minutes · optional
The stats ... by (...) pipe turns raw logs into aggregate numbers; _time:5m restricts to recent time (LogsQL).
curl -s -G 'http://localhost:9428/select/logsql/query' --data-urlencode 'query=* | stats by (level) count() | sort by (count) desc'
1. Run * | stats by (level) count() and * | stats by (app_name) count() to see the log distribution.
The result comes as group + count, e.g. {"level":"info","count(*)":"32"}, {"level":"error","count(*)":"1"} (the numbers depend on the actual logs on your machine).
2. Filter recent errors: _time:5m level:error.
It returns only the level=error logs from the last 5 minutes.
5 minutes · optional
vmui is the built-in UI for typing LogsQL and viewing logs without curl.
Grafana has a VictoriaLogs datasource for building dashboards (VictoriaLogs datasource).
# Open a browser
http://<host>:9428/select/vmui
1. Open http://<host>:9428/select/vmui, then type level:error or _stream:{app_name="demo"}.
An interactive log table, filterable by time; the same results as curl, but visual.
Question 1. Which HTTP port does the lab use by default for queries and for opening vmui on the victoria-logs single-node?
:9428
:8428
:5410
:3000
Answer: :9428.
The lab sets -httpListenAddr=:9428 for the HTTP API and /select/vmui. (:8428 is the default port of VictoriaMetrics single-node for metrics; :5410 is the syslog port set in the lab.)
Question 2. Which field does a bare word filter such as error in LogsQL match on by default?
_msg
_stream
app_name
level
Answer: _msg. By default a word filter searches for a substring in _msg (word filter).
To filter on another field you must write field:value explicitly.
Question 3. To get exactly the logs of one source (e.g. app_name="demo"), which LogsQL form is the most appropriate?
_stream:{app_name="demo"}
demo
SELECT * WHERE app="demo"
app=="demo"
Answer: _stream:{app_name="demo"}. Filter by source with the stream filter _stream:{app_name="demo"}.
The word filter demo only searches in _msg, so it misses logs; LogsQL does not use SQL syntax.
Question 4. How does VictoriaLogs differ from VictoriaMetrics?
VictoriaLogs is for logs and uses LogsQL; VictoriaMetrics is for metrics and uses MetricsQL
They are identical, only the names differ
VictoriaLogs is merely a plugin of VictoriaMetrics and cannot run on its own
VictoriaLogs is queried with PromQL
Answer: VictoriaLogs is for logs and uses LogsQL; VictoriaMetrics is for metrics and uses MetricsQL.
VictoriaLogs is an independent product (its own repo, VictoriaMetrics/VictoriaLogs) for logs, queried with LogsQL; VictoriaMetrics is for metrics, queried with MetricsQL (a superset of PromQL).
What are the three special fields of a log entry in VictoriaLogs?
_msg (message), _time (time), _stream (stream, together with _stream_id).
What is the default HTTP port of victoria-logs single-node (in the lab)?
:9428 — it serves queries at /select/logsql/query and the UI at /select/vmui.
Where does a bare word filter in LogsQL match?
In _msg. To filter on other fields you must write field:value or _stream:{...}.
What kind of fields should you choose as stream fields?
Stable fields with few distinct values (e.g. app_name, hostname). Avoid high-cardinality fields such as request_id.
What are the three components of the cluster edition of VictoriaLogs?
vlinsert (ingest), vlstorage (storage), vlselect (queries).
Which flag enables receiving syslog on victoria-logs?
-syslog.listenAddr.tcp=:5410 (or .udp). rsyslog forwards with omfwd + the RFC 5424 template.
How do you count logs by level with LogsQL?
* | stats by (level) count() — you can chain | sort by (count) desc.