Skip to content

feat(monitoring): turn on the Loki pattern ingester #5260

Closed

Description

@dan-petty

Problem or Motivation

The Loki pattern ingester is off. On 2026-11-12, the Grafana MCP tool query_loki_patterns with the selector {namespace="devops"} returned HTTP 404 ("loki API returned status code 404"). The Patterns tab of Logs Drilldown (grafana-lokiexplore-app 3.1.0, installed) is empty.

  • k8s/logging/loki-values.yaml sets no pattern_ingester value. Thus the default of chart 21.2.1 applies: pattern_ingester: enabled: false (chart values.yaml:850-851).
  • The live Loki /config (through the Grafana data source proxy) gives pattern_persistence_enabled: false. The other Drilldown settings are on: allow_structured_metadata: true, volume_enabled: true and discover_log_levels: true.

With patterns, an agent reads a small number of templates with counts, not many log lines (AGENTS.md rule 14). A new error shape shows in triage, with no query.

Limit: the pattern ingester keeps patterns in memory for 3 h (retain_for: 3h0m0s), and pattern persistence is off. The querier reads patterns only from the ingester window (Loki v3.7.9 pkg/querier/http.go:452-464). Thus patterns are for triage. A weekly review cannot use them.

Proposed Solution & Architectural Design

In k8s/logging/loki-values.yaml, under loki: (line 8), add this value:

  pattern_ingester:
    enabled: true
  • Chart 21.2.1 writes this value into the Loki configuration (chart values.yaml:353-356).
  • In Loki v3.7.9, the all target of the Monolithic mode includes PatternIngester (pkg/loki/loki.go:866). Its ring uses the memberlist that runs now.
  • Keep pattern persistence off. Pattern persistence writes pattern streams back into Loki. Make that a separate decision later.
  • The change adds no pod, no NetworkPolicy change and no egress.

Risk: a small memory increase in loki-0, and one Loki restart. Loki holds 97 active streams (sum(loki_ingester_memory_streams)) at approximately 13 lines/s (sum(rate(loki_distributor_lines_received_total[1h]))). Each stream holds a maximum of 300 patterns. In 7 d, the peak working set of Loki was 452 MiB of its 2048Mi limit. The patterns come from log lines that Loki stores now, so no new data leaves the cluster.

Target Subsystem

Kubernetes & Minikube Automation (k8s/logging/).

Existing Tool Considered

The Loki pattern ingester (Grafana Labs, part of the deployed Loki v3.7.9) and Logs Drilldown 3.1.0 (installed). The Grafana documentation says: "Enable pattern ingestion by setting pattern_ingester.enabled to true" (https://grafana.com/docs/grafana-cloud/learn-and-build/visualizations/simplified-exploration/logs/access/). Loki is AGPL-3.0. It runs now as a separate service, and this change is configuration only. No new code.

Acceptance Criteria

  • helm template of chart grafana-community/loki 21.2.1 with k8s/logging/loki-values.yaml writes pattern_ingester: with enabled: true into the Loki configuration.
  • After the Argo CD sync, the Loki /config endpoint gives pattern_ingester with enabled: true.
  • The Grafana MCP query_loki_patterns with {namespace="devops"} over the last 1 h returns HTTP 200 and one or more patterns.
  • The Patterns tab of Logs Drilldown shows patterns for the devops namespace.
  • For 24 h after the change, max_over_time(container_memory_working_set_bytes{namespace="logging", container="loki"}[24h]) stays below 80 % of the 2048Mi limit. The pull request gives the value before and after the change.

Related

#4989 (cluster integration plan), #5172 (Loki ruler: fewer 7-day line scans).

Owner approved on 2026-11-12.

Source: https://github.com/dan-petty/devops-cli/blob/main/k8s/logging/loki-values.yaml

Activity

  1. added
    source/agent
    type/feature
    scope/monitoring
    status/new
    value/medium
    effort/low
    on Nov 12, 2026
  2. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    on Nov 12, 2026
  4. added
    status/in-review
    and removed
    status/new
    on Nov 15, 2026
  5. removed
    status/in-review
    on Nov 15, 2026
  6. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-15 13:55 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/monitoringsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions