Grafana Loki Knowledge Patch
Use this skill when implementing, upgrading, deploying, or operating Grafana
Loki and the work may depend on recent LogQL, ingestion, storage, Helm,
Operator, deletion, API, or command-line behavior. Inspect the deployment's
Loki and chart versions before applying version-sensitive guidance, then read
every topic reference relevant to the task.
Reference index
| Reference |
Topics |
| Migrations and breaking changes |
Promtail, deployment modes, removed configuration, changed defaults, chart ownership, and upgrade hazards |
| Helm and deployment |
Chart rendering, workloads, probes, persistence, DNS, caches, storage wiring, and services |
| Ingestion, labels, and limits |
Stream sharding, structured metadata, relabeling, distributor limits, Kafka, policies, and label discovery |
| Operator, integrations, and observability |
Loki Operator, OTLP, OpenTelemetry tracing, Fluent integrations, monitoring, networking, and Operational UI |
| Queries, APIs, and command-line tools |
LogQL semantics, query results, endpoints, caching, Patterns, logcli, lokitool, ruler checks, and label sketches |
| Storage, deletion, and compaction |
Object stores, Thanos clients, SQLite delete requests, scalable deletion, deletion markers, and index gateways |
Handle breaking changes first
Move Promtail users to Alloy
Promtail was deprecated after its code moved into Grafana Alloy and was removed
as of 3.7.3. Use the migration documentation and configuration-conversion
utility. Do not apply that removal to Lambda-promtail, which remains separate.
Audit Promtail image extensions and health checks independently: the image no
longer contains wget, so scripts, probes, and derived images must provide a
different client or package the tool themselves.
Preserve label and query semantics
Parsed labels no longer replace same-named structured metadata. Treat this as a
breaking precedence change and update pipelines or assertions that relied on
the parsed value winning.
Range-query evaluation aligns timestamps to the step grid as of 3.7.3, and the
query engine no longer silently discards OR operations. Recheck golden
results, alert evaluations, and cache expectations around both changes.
Recheck scheduler capacity assumptions
Scheduler accounting uses total compute capacity, and worker threads are
shared across all scheduler connections. Both execution changes are breaking;
revisit sizing, concurrency assumptions, and performance tests rather than
carrying forward per-connection worker calculations.
Audit removed and deprecated deployment paths
- Simple Scalable Deployment is deprecated and scheduled for removal before
Loki 4.0.
- The community
LGTM-distributed, loki-canary, loki-distributed, and
loki-simple-scalable charts are deprecated.
- Deprecated ksonnet configurations are removed.
- BoltDB storage, legacy configuration options, and legacy API endpoints are
deprecated and require an upgrade audit.
- The open-source Loki chart moved to the
grafana-community/helm-charts repository on March 16, 2026; the GEL chart
remains maintained separately.
Check Operator-specific breakage
Dropping OTLP attributes through the Operator is classified as breaking.
OpenShift's default stream labels also changed, so validate tenant selectors,
dashboards, alerts, and retention rules after an Operator upgrade.
On OCP 4.20, the Operator no longer creates NetworkPolicies automatically.
Supply the required policies explicitly when isolation depends on them.
Update container-relative paths
Loki containers now use the filesystem root as their working directory.
Derived images, entrypoints, and scripts must not assume the previous relative
path base.
Upgrade checklist
- Identify the Loki binary, Helm chart, and Operator versions separately.
- Read the migration reference and inventory Promtail, ksonnet, BoltDB,
legacy endpoints, and deprecated chart or deployment-mode dependencies.
- Compare values files with renamed and newly templated settings, especially
object_store.storage_prefix, storage generation bypasses, ruler storage,
authentication, caches, and workload persistence.
- Validate ingestion with empty pushes, structured metadata, OTLP byte
accounting, policy limits, Kafka topics, and time sharding.
- Re-run representative LogQL queries for parsed-label precedence, range
timestamps,
OR, offsets, approx_topk, JSON parsing, and byte comparisons.
- Exercise storage, compaction, retention, and delete-request workflows with
the deployment's actual object-store client and filesystem behavior.
- Check Operator-generated networking, certificates, object-store addressing,
authorization, metrics authentication, and OpenShift-specific resources.
- Verify probes, sidecars, relative paths, Services, PVC retention, DNS, and
topology placement in rendered manifests before rollout.
Ingestion quick reference
Enable tenant-scoped time sharding deliberately
Set shard_streams.time_sharding_enabled: true for tenants that must accept
logs far outside the ordinary out-of-order window. Loki adds
__time_shard__, limiting each resulting stream to at most half of
max_chunk_age—normally one hour.
Treat structured metadata as a first-class ingestion path
Tenant configuration can extract structured metadata from labels, existing
metadata, or fields parsed from JSON and logfmt lines. Account for metadata
bytes in OTLP limits, suppress duplicates sourced from both labels and
extracted fields, and expect JSON strings to be unescaped.
Automatic log-level discovery handles nested JSON, removes colons from detected
levels, and accepts numeric boolean detected-label values. The pattern ingester
can emit detected level as structured metadata.
Place and explain distributor enforcement
Limits may be enforced in distributors or checked there in dry-run mode.
Aggregated metric streams bypass ordinary label enforcement, and rate-limit
reasons identify stream labels rather than only a hash. Configure the
uncompressed receive ceiling with distributor MaxRecvMsgSize and recognize
the identifier placed on truncated lines.
Merge policy mappings
Per-policy stream limits can override ingestion limits. Per-tenant
ingestion-policy mappings merge with defaults; they do not replace the default
mapping wholesale.
Query and API quick reference
Review status-code and routing changes
- An empty push request returns HTTP 422.
- Interval-limit violations return HTTP 400.
- Label-values requests work with
server.http_path_prefix.
- Aggregated metric queries are accepted only from Logs Drilldown.
- Requests for an unknown tenant through the applied-limits endpoint return
default limits.
Use corrected LogQL behavior
Offsets apply correctly to last_over_time, first_over_time, and
quantile_over_time; approx_topk is mapped in all cases; the query-path JSON
parser preserves log lines; zero-byte comparisons are valid; and detected
fields recognize byte units.
Query APIs can return Parquet for columnar consumers. Query-range requests can
disable caching as of 3.7.3, and multi-tenant requests are accepted by the
Patterns API.
Preserve label sketches
In 3.7.6, query-range MergeLabels preserves sketch data while merging label
responses. Consumers should use the returned sketch instead of assuming merged
results omit it.
Storage and deletion quick reference
Match the object-store client to its compatibility details
Loki moved object-store access to the shared Thanos client and added Swift via
thanos.io/objstore. Verify provider-specific behavior: custom GCS endpoints,
Swift TLS CAs, Windows MinIO delimiters, S3 region preservation, Object Lock
checksums, and legacy S3 index filenames all have distinct guidance.
Scale deletion without moving singleton work
The experimental scalable deletion path delegates queued delete work from the
Compactor to workers. Index compaction and retention remain in the singleton
Compactor. SQLite delete-request storage uses stored completion times to narrow
query-time filtering, while object-backed deletion markers avoid local-disk
state.
Helm and Operator quick reference
Render values before rollout
The chart applies tpl in more locations, including nameOverride, read,
write, backend, pattern-ingester, ingester-client, and operational
configuration. Render charts in CI to catch evaluation, namespace, generated
storage, and ownership differences.
Validate workload lifecycle
Check startup and readiness probes, SingleBinary topology spreading, canary
Deployment mode, configurable init containers, PVC access modes and labels,
retention-on-scale-down behavior, volumeAttributesClassName, and per-workload
dnsConfig.
Treat generated Operator resources as version-sensitive
The Operator can suppress ingress, customize gateway certificates, deploy
NetworkPolicies, configure virtual-host S3 and Swift TLS, and apply
OpenTelemetry authorization semantics. Metrics authentication no longer
depends on kube-rbac-proxy as of 3.7.3, and AWS STS deployments receive their
region through an environment variable.
Route work to the detailed references
- For upgrade planning, removals, changed defaults, or compatibility audits,
read
migrations-and-breaking-changes.md first.
- For chart values, rendered resources, workloads, persistence, caches, and
Services, read
helm-and-deployment.md.
- For push paths, labels, structured metadata, limits, policies, or Kafka,
read
ingestion-labels-and-limits.md.
- For Loki Operator, OTLP, tracing, monitoring, Fluent, or Operational UI,
read
operator-integrations-and-observability.md.
- For LogQL, query APIs, labels, Patterns, ruler tooling, or CLI behavior,
read
queries-apis-and-cli.md.
- For object storage, index gateways, compaction, retention, or deletion,
read
storage-deletion-and-compaction.md.
1---2name: grafana-loki-knowledge-patch3description: Grafana Loki4license: MIT5---678# Grafana Loki Knowledge Patch910Use this skill when implementing, upgrading, deploying, or operating Grafana11Loki and the work may depend on recent LogQL, ingestion, storage, Helm,12Operator, deletion, API, or command-line behavior. Inspect the deployment's13Loki and chart versions before applying version-sensitive guidance, then read14every topic reference relevant to the task.1516## Reference index1718| Reference | Topics |19| --- | --- |20| [Migrations and breaking changes](references/migrations-and-breaking-changes.md) | Promtail, deployment modes, removed configuration, changed defaults, chart ownership, and upgrade hazards |21| [Helm and deployment](references/helm-and-deployment.md) | Chart rendering, workloads, probes, persistence, DNS, caches, storage wiring, and services |22| [Ingestion, labels, and limits](references/ingestion-labels-and-limits.md) | Stream sharding, structured metadata, relabeling, distributor limits, Kafka, policies, and label discovery |23| [Operator, integrations, and observability](references/operator-integrations-and-observability.md) | Loki Operator, OTLP, OpenTelemetry tracing, Fluent integrations, monitoring, networking, and Operational UI |24| [Queries, APIs, and command-line tools](references/queries-apis-and-cli.md) | LogQL semantics, query results, endpoints, caching, Patterns, `logcli`, `lokitool`, ruler checks, and label sketches |25| [Storage, deletion, and compaction](references/storage-deletion-and-compaction.md) | Object stores, Thanos clients, SQLite delete requests, scalable deletion, deletion markers, and index gateways |2627## Handle breaking changes first2829### Move Promtail users to Alloy3031Promtail was deprecated after its code moved into Grafana Alloy and was removed32as of 3.7.3. Use the migration documentation and configuration-conversion33utility. Do not apply that removal to Lambda-promtail, which remains separate.3435Audit Promtail image extensions and health checks independently: the image no36longer contains `wget`, so scripts, probes, and derived images must provide a37different client or package the tool themselves.3839### Preserve label and query semantics4041Parsed labels no longer replace same-named structured metadata. Treat this as a42breaking precedence change and update pipelines or assertions that relied on43the parsed value winning.4445Range-query evaluation aligns timestamps to the step grid as of 3.7.3, and the46query engine no longer silently discards `OR` operations. Recheck golden47results, alert evaluations, and cache expectations around both changes.4849### Recheck scheduler capacity assumptions5051Scheduler accounting uses total compute capacity, and worker threads are52shared across all scheduler connections. Both execution changes are breaking;53revisit sizing, concurrency assumptions, and performance tests rather than54carrying forward per-connection worker calculations.5556### Audit removed and deprecated deployment paths5758- Simple Scalable Deployment is deprecated and scheduled for removal before59 Loki 4.0.60- The community `LGTM-distributed`, `loki-canary`, `loki-distributed`, and61 `loki-simple-scalable` charts are deprecated.62- Deprecated ksonnet configurations are removed.63- BoltDB storage, legacy configuration options, and legacy API endpoints are64 deprecated and require an upgrade audit.65- The open-source Loki chart moved to the66 `grafana-community/helm-charts` repository on March 16, 2026; the GEL chart67 remains maintained separately.6869### Check Operator-specific breakage7071Dropping OTLP attributes through the Operator is classified as breaking.72OpenShift's default stream labels also changed, so validate tenant selectors,73dashboards, alerts, and retention rules after an Operator upgrade.7475On OCP 4.20, the Operator no longer creates NetworkPolicies automatically.76Supply the required policies explicitly when isolation depends on them.7778### Update container-relative paths7980Loki containers now use the filesystem root as their working directory.81Derived images, entrypoints, and scripts must not assume the previous relative82path base.8384## Upgrade checklist85861. Identify the Loki binary, Helm chart, and Operator versions separately.872. Read the migration reference and inventory Promtail, ksonnet, BoltDB,88 legacy endpoints, and deprecated chart or deployment-mode dependencies.893. Compare values files with renamed and newly templated settings, especially90 `object_store.storage_prefix`, storage generation bypasses, ruler storage,91 authentication, caches, and workload persistence.924. Validate ingestion with empty pushes, structured metadata, OTLP byte93 accounting, policy limits, Kafka topics, and time sharding.945. Re-run representative LogQL queries for parsed-label precedence, range95 timestamps, `OR`, offsets, `approx_topk`, JSON parsing, and byte comparisons.966. Exercise storage, compaction, retention, and delete-request workflows with97 the deployment's actual object-store client and filesystem behavior.987. Check Operator-generated networking, certificates, object-store addressing,99 authorization, metrics authentication, and OpenShift-specific resources.1008. Verify probes, sidecars, relative paths, Services, PVC retention, DNS, and101 topology placement in rendered manifests before rollout.102103## Ingestion quick reference104105### Enable tenant-scoped time sharding deliberately106107Set `shard_streams.time_sharding_enabled: true` for tenants that must accept108logs far outside the ordinary out-of-order window. Loki adds109`__time_shard__`, limiting each resulting stream to at most half of110`max_chunk_age`—normally one hour.111112### Treat structured metadata as a first-class ingestion path113114Tenant configuration can extract structured metadata from labels, existing115metadata, or fields parsed from JSON and `logfmt` lines. Account for metadata116bytes in OTLP limits, suppress duplicates sourced from both labels and117extracted fields, and expect JSON strings to be unescaped.118119Automatic log-level discovery handles nested JSON, removes colons from detected120levels, and accepts numeric boolean detected-label values. The pattern ingester121can emit detected level as structured metadata.122123### Place and explain distributor enforcement124125Limits may be enforced in distributors or checked there in dry-run mode.126Aggregated metric streams bypass ordinary label enforcement, and rate-limit127reasons identify stream labels rather than only a hash. Configure the128uncompressed receive ceiling with distributor `MaxRecvMsgSize` and recognize129the identifier placed on truncated lines.130131### Merge policy mappings132133Per-policy stream limits can override ingestion limits. Per-tenant134ingestion-policy mappings merge with defaults; they do not replace the default135mapping wholesale.136137## Query and API quick reference138139### Review status-code and routing changes140141- An empty push request returns HTTP 422.142- Interval-limit violations return HTTP 400.143- Label-values requests work with `server.http_path_prefix`.144- Aggregated metric queries are accepted only from Logs Drilldown.145- Requests for an unknown tenant through the applied-limits endpoint return146 default limits.147148### Use corrected LogQL behavior149150Offsets apply correctly to `last_over_time`, `first_over_time`, and151`quantile_over_time`; `approx_topk` is mapped in all cases; the query-path JSON152parser preserves log lines; zero-byte comparisons are valid; and detected153fields recognize byte units.154155Query APIs can return Parquet for columnar consumers. Query-range requests can156disable caching as of 3.7.3, and multi-tenant requests are accepted by the157Patterns API.158159### Preserve label sketches160161In 3.7.6, query-range `MergeLabels` preserves sketch data while merging label162responses. Consumers should use the returned sketch instead of assuming merged163results omit it.164165## Storage and deletion quick reference166167### Match the object-store client to its compatibility details168169Loki moved object-store access to the shared Thanos client and added Swift via170`thanos.io/objstore`. Verify provider-specific behavior: custom GCS endpoints,171Swift TLS CAs, Windows MinIO delimiters, S3 region preservation, Object Lock172checksums, and legacy S3 index filenames all have distinct guidance.173174### Scale deletion without moving singleton work175176The experimental scalable deletion path delegates queued delete work from the177Compactor to workers. Index compaction and retention remain in the singleton178Compactor. SQLite delete-request storage uses stored completion times to narrow179query-time filtering, while object-backed deletion markers avoid local-disk180state.181182## Helm and Operator quick reference183184### Render values before rollout185186The chart applies `tpl` in more locations, including `nameOverride`, read,187write, backend, pattern-ingester, ingester-client, and operational188configuration. Render charts in CI to catch evaluation, namespace, generated189storage, and ownership differences.190191### Validate workload lifecycle192193Check startup and readiness probes, SingleBinary topology spreading, canary194Deployment mode, configurable init containers, PVC access modes and labels,195retention-on-scale-down behavior, `volumeAttributesClassName`, and per-workload196`dnsConfig`.197198### Treat generated Operator resources as version-sensitive199200The Operator can suppress ingress, customize gateway certificates, deploy201NetworkPolicies, configure virtual-host S3 and Swift TLS, and apply202OpenTelemetry authorization semantics. Metrics authentication no longer203depends on `kube-rbac-proxy` as of 3.7.3, and AWS STS deployments receive their204region through an environment variable.205206## Route work to the detailed references207208- For upgrade planning, removals, changed defaults, or compatibility audits,209 read `migrations-and-breaking-changes.md` first.210- For chart values, rendered resources, workloads, persistence, caches, and211 Services, read `helm-and-deployment.md`.212- For push paths, labels, structured metadata, limits, policies, or Kafka,213 read `ingestion-labels-and-limits.md`.214- For Loki Operator, OTLP, tracing, monitoring, Fluent, or Operational UI,215 read `operator-integrations-and-observability.md`.216- For LogQL, query APIs, labels, Patterns, ruler tooling, or CLI behavior,217 read `queries-apis-and-cli.md`.218- For object storage, index gateways, compaction, retention, or deletion,219 read `storage-deletion-and-compaction.md`.