Skip to main content

Core deployment pattern

Use a Loki-compatible read proxy in front of VictoriaLogs

Loki-VL-proxy sits between Grafana or other Loki clients and VictoriaLogs. It keeps the read-side Loki API shape, translates metadata and query behavior where needed, and exposes route-aware telemetry so the middle layer stays operable.

365 of 568
First requests below Loki v3.7.10 in the latest weekly A/B (2026-11-16, loki-defaults)
Above 2× Loki: 6. Same data and hardware for both; generated weekly.
~14 MB
Static Go binary — no runtime dependencies
Sits in front of any VictoriaLogs single-node or cluster deployment.
4-tier cache
Tier0, L1 memory (256 MB default), L2 disk (bbolt), L3 peer (consistent hash + zstd)
Circuit breaker and request coalescer protect the backend.
~15–30 ms
Added latency on a cold cache miss — near-zero on a warm hit
Prefilter eliminates ~81.6% of empty-window backend calls.

What the proxy actually does

  • Accepts Loki-compatible read and metadata requests.
  • Translates query and metadata paths toward VictoriaLogs and optional rules backends.
  • Shapes responses into the tuple and field contracts Grafana expects.
  • Adds a 4-tier cache stack (Tier0, L1 memory, L2 bbolt disk, L3 peer) plus request coalescing and a sliding-window circuit breaker (30s window, 5 failure threshold) to protect the backend.
  • Prefilters long-range queries and eliminates ~81.6% of empty-window backend calls.

What it intentionally does not do

  • It does not become a generic log ingestion system.
  • It does not ask Grafana to switch to a custom datasource plugin.
  • It does not hide its own latency or cache behavior from operators.
  • It does not open write ownership for Loki push paths.

Measured against Loki v3.7.10

The latest weekly A/B run, 2026-11-16 at commit 5b5c7965fc: the same data and hardware for both, 39 query-shape sets over 1h to 24h. A row is one query shape over one time range; faster or slower means beyond 25% and 50 ms, and a first request Loki's results cache answered is not judged. The same figures are generated into the README.

Loki profileRequestRows compared🟢 Below Loki🟡 Close to Loki🟠 1–2× Loki🔴 Above 2× Loki
loki-defaultsfirst568365 (64.3%)183 (32.2%)14 (2.5%)6 (1.1%)
loki-defaultsrepeat765187 (24.4%)568 (74.2%)4 (0.5%)6 (0.8%)
alignedfirst447312 (69.8%)120 (26.8%)13 (2.9%)2 (0.4%)
alignedrepeat52922 (4.2%)500 (94.5%)2 (0.4%)5 (0.9%)
Workload (loki-defaults)Pairs🟢 / 🟡 / 🔴First request p50 · p90 · slowest: proxyLokiRepeat p50: proxyLoki
Metadata and label browser72 / 2 / 30.28 · 1.62 · 1.62 s0.10 · 0.38 · 0.38 s🟢 0.03 s0.10 s
Drilldown and Explore pages11885 / 25 / 80.12 · 1.06 · 6.73 s0.35 · 4.96 · 9.85 s🟡 0.03 s0.05 s
Log queries7939 / 39 / 10.02 · 0.08 · 0.24 s0.08 · 0.42 · 1.58 s🟢 0.01 s0.08 s
Metric queries366239 / 117 / 100.10 · 1.04 · 6.52 s0.27 · 4.65 · 44.02 s🟡 0.02 s0.02 s

First request by the time range a user picks, p50 · p90 · slowest pair:

WorkloadRangePairs🟢 / 🟡 / 🔴ProxyLoki
Drilldown and Explore pages1h4026 / 12 / 20.04 · 0.11 · 0.43 s0.24 · 0.33 · 0.64 s
Drilldown and Explore pages6h3627 / 8 / 10.16 · 0.76 · 1.09 s0.93 · 1.41 · 2.82 s
Drilldown and Explore pages24h4031 / 4 / 50.50 · 2.46 · 6.73 s4.16 · 5.53 · 9.85 s
Log queries1h314 / 26 / 10.05 · 0.08 · 0.09 s0.07 · 0.11 · 0.15 s
Log queries3h88 / 0 / 00.01 · 0.01 · 0.01 s0.08 · 0.14 · 0.14 s
Log queries6h2013 / 7 / 00.01 · 0.04 · 0.08 s0.08 · 0.41 · 0.50 s
Log queries24h2014 / 6 / 00.01 · 0.06 · 0.24 s0.11 · 1.50 · 1.58 s
Metric queries1h13069 / 57 / 40.03 · 0.12 · 0.36 s0.13 · 0.30 · 3.98 s
Metric queries6h10178 / 20 / 30.17 · 0.62 · 1.78 s0.66 · 1.60 · 14.84 s
Metric queries24h9983 / 13 / 30.63 · 2.49 · 6.52 s3.35 · 6.55 · 31.26 s

The heaviest queries for Loki, the ones a user waits for:

Query shapeRangeWorkloadProxyLokiProxy vs Loki
F1 sum by over a ratio of two per-stream metrics, 20s step24h-20sMetric queries4.14 s44.02 s🟢 10.6× faster
B2 sum by over a ratio of two per-stream metrics24hMetric queries3.81 s31.26 s🟢 8.2× faster
F3 avg by service of rate, 20s step24h-20sMetric queries1.82 s16.32 s🟢 9.0× faster
B2 sum by over a ratio of two per-stream metrics6hMetric queries1.05 s14.84 s🟢 14.1× faster
F2 count by service of count_over_time, 20s step24h-20sMetric queries0.01 s ‡12.39 s🟢 1376.4× faster
F4 sum of max by service,app, 20s step24h-20sMetric queries4.43 s12.37 s🟢 2.8× faster
DB1 label breakdown pod24hDrilldown and Explore pages1.33 s9.85 s🟢 7.4× faster
SF9 volume, logfmt label_format rename24hMetric queries3.58 s8.38 s🟢 2.3× faster
E3 logfmt latency_ms rate, production24hMetric queries1.86 s8.27 s🟢 4.4× faster
logfmt volume24hMetric queries1.46 s8.07 s🟢 5.5× faster

‡ The proxy answered a first request over 6h or more in under 50 ms: probably from its own cache, warmed by an earlier set of the weekly run that sent the same query. The run records Loki's cache counters but not the proxy's, so this row is not a cold proxy.

Where the proxy loses most:

Query shapeRangeWorkloadProxyLokiProxy vs Loki
DP1 patterns of a plain-text service1hMetadata and label browser0.33 s0.02 s🔴 14.5× slower
DP2 patterns of an environment1hMetadata and label browser1.62 s0.27 s🔴 6.0× slower
LF29 logs, drop detected_level1hLog queries0.08 s0.01 s🔴 5.5× slower
LS8 json count by level_extracted, collision1hMetric queries0.14 s0.04 s🔴 3.4× slower
LS8 json count by level_extracted, collision6hMetric queries0.56 s0.17 s🔴 3.3× slower

Readiness by client: the Loki endpoints each client calls, their evidence, and the open differences it shows.

ClientLoki endpoints it callsRoutedCompared with Loki in testsProvenOpen differences it shows
Grafana Explore101010864
Logs Drilldown111111917
Grafana Loki datasource66641
Loki API clients2725191221
  • Answers: 719 of 785 pairs return the same result as Loki, 51 differ and 15 could not be compared.
  • Loki read API: 25 of 27 endpoints routed, 19 with tests that compare the proxy against Loki, 12 proven.
  • Known differences from Loki: 174 ranked, 149 open; 82 of the open ones are visible in Grafana (64 Explore, 17 Logs Drilldown, 1 Grafana datasource). Each is listed in the ranked differences.
  • Every shape and range, the open gaps and the regression gate: performance evidence.

Why this pattern works for Grafana

Grafana is already deeply opinionated around the Loki datasource and the Loki-style query path. Loki-VL-proxy keeps that client shape on the left while mapping requests to VictoriaLogs-aware internals on the right.

Labels and fields stay manageable

The proxy can expose underscore labels for Loki-safe query builder behavior while keeping dotted field semantics available through metadata modes and explicit mappings.

Patterns and Drilldown stay explicit

The Loki-compatible patterns endpoint is part of the supported read surface, with runtime gating and compatibility coverage for Grafana Logs Drilldown behavior.

Rules and alerts can stay visible

Read views for rules and alerts can be bridged through vmalert so Grafana does not lose those operational screens during the move. Alerting itself is not finished: vmalert runs the rules, and Loki-compatible rule evaluation is planned work.

Operators get their own control plane

The project ships route-aware metrics, structured logs, a packaged dashboard, and runbook-oriented docs instead of treating the proxy as a black box.

Where to go next

If this is the problem you are trying to solve, the next useful docs are the deployment guide, translation behavior, and observability model.