/platform-extras-skills:loki-log-aggregation-configurationfrom platform-extras-skills
Configures Grafana Loki as a log aggregation backend — ingestion limits, label/cardinality design, retention, index/chunk schema, object-storage backends, and deployment modes (single-binary, simple-scalable, microservices).
Ships in platform-extras-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Loki indexes only a small label set per log stream and stores the log
content itself as compressed chunks in object storage — a deliberate
design trade-off (cheap to run at scale, versus Elasticsearch's
full-text index) that only pays off if labels are chosen with
cardinality discipline and ingestion limits/retention are configured for
real volume, not left at chart defaults. This skill covers configuring
Loki itself as the aggregation backend: label/cardinality design,
limits_config ingestion controls, the schema/chunk store config that
determines the index format and storage backend, retention, and
deployment-mode selection — not the queries run against it (see
logql-query-authoring) and not
pre-deploy config validation (see
loki-configuration-validation),
which is a distinct, narrower concern from standing up Loki in the first
place.
429/entry too far behind/
per-stream rate limit exceeded) or silently dropping expected log
volume.boltdb-shipper
schema configs still work but TSDB is preferred for new deployments).loki or
loki-distributed/loki-simple-scalable Helm charts) or bare
VMs/containers running the Loki binary directly.auth_enabled: true and a clear tenant-ID
(X-Scope-OrgID) scheme agreed with whatever is pushing logs.Choose a deployment mode deliberately, by volume, not by default.
-target=all): simplest, fine for low volume/dev/
small production. All components (distributor, ingester, querier,
etc.) run in one process.-target=read / -target=write / -target=backend):
splits the read and write paths into independently scaled
deployments — the right default for most production Kubernetes
setups once volume grows past what single-binary comfortably
handles.Design labels for cardinality, not convenience, before ingesting anything at volume. Every distinct combination of label values creates a separate stream, and Loki's index grows with the number of streams, not the number of log lines:
# GOOD: bounded, small label set
labels:
app: payments-api
namespace: payments
env: production
level: error # small enumerated set (debug/info/warn/error)
# BAD: unbounded/high-cardinality labels — never do this
labels:
app: payments-api
request_id: "a1b2c3..." # unique per request — unbounded
user_id: "48213" # unbounded
pod_ip: "10.2.3.41" # high cardinality, churns on every restart
Warning — unbounded cardinality: a label like
request_id,user_id,trace_id, or a raw pod IP explodes the number of streams Loki has to track, degrading ingestion and query performance cluster-wide, not just for whoever added the label. Fields like these belong in the log line content (extracted at query time via| json/| logfmt— see logql-query-authoring), never as indexed labels. If unsure whether a label is safe, check its cardinality before it ships broadly (see loki-configuration-validation for pre-deploy checks).
Configure ingestion limits in limits_config to protect the
cluster from a runaway/misbehaving shipper, rather than leaving
defaults that either reject legitimate traffic or let one bad actor
overwhelm shared infrastructure:
limits_config:
ingestion_rate_mb: 10 # sustained MB/s per tenant
ingestion_burst_size_mb: 20 # short burst allowance above the rate
per_stream_rate_limit: 5MB # per-stream ingestion rate ceiling
per_stream_rate_limit_burst: 15MB
max_streams_per_user: 10000 # hard ceiling on distinct streams per tenant
max_line_size: 256KB
reject_old_samples: true
reject_old_samples_max_age: 168h # 7 days
max_streams_per_user is the single most important cardinality
backstop — set it deliberately based on expected label cardinality
times expected app/namespace count, not left unbounded.
Set retention explicitly, per tenant if multi-tenant, via the compactor — Loki does not delete old chunks on its own without a configured retention policy:
compactor:
working_directory: /loki/compactor
retention_enabled: true
delete_request_store: s3
limits_config:
retention_period: 720h # 30 days, cluster default
# per-tenant override (in runtime overrides config, not limits_config)
overrides:
"tenant-payments":
retention_period: 2160h # 90 days for a tenant needing longer retention
Retention is enforced by the compactor component — it must be
running (and retention_enabled: true set) for old chunks to actually
be deleted; setting retention_period alone with the compactor
disabled leaves chunks accumulating indefinitely in object storage.
Configure the schema and storage backend together — the schema config determines the index format (TSDB is current-recommended) and is versioned by date so you can roll forward without rewriting historical data:
schema_config:
configs:
- from: 2024-01-01
store: tsdb
object_store: s3
schema: v13
index:
prefix: loki_index_
period: 24h
storage_config:
tsdb_shipper:
active_index_directory: /loki/tsdb-index
cache_location: /loki/tsdb-cache
aws:
s3: s3://<AWS_REGION>/<S3_BUCKET_NAME>
s3forcepathstyle: false
Adding a new schema_config.configs entry with a future from: date
is how you change schema/store version going forward without
rewriting already-ingested data under the old schema — never edit an
existing entry's from: date retroactively.
Size the ingester's replication and WAL settings for durability in a scaled (non-single-binary) deployment:
ingester:
wal:
enabled: true
dir: /loki/wal
lifecycler:
ring:
replication_factor: 3
chunk_idle_period: 30m
chunk_target_size: 1572864 # ~1.5MB compressed target per chunk
max_chunk_age: 2h
replication_factor: 3 (typical) means each stream's data is written
to 3 ingesters before being acknowledged, so a single ingester pod
loss doesn't lose in-flight (not-yet-flushed-to-storage) log data;
the WAL protects against loss during ingester restarts specifically.
Confirm ingestion is actually flowing and within limits after deploying:
curl -s http://<LOKI>/ready
curl -s http://<LOKI>/metrics | grep -E 'loki_ingester_streams_created_total|loki_discarded_samples_total'
A rising loki_discarded_samples_total counter (with a reason
label such as rate_limited, stream_limit, or line_too_long)
means logs are being silently dropped at ingestion — check that
reason against the limits_config values in step 3 before assuming
the shipper is misbehaving.
max_streams_per_user and per-stream rate limits explicitly rather
than relying on defaults meant for evaluation-scale deployments —
defaults that are too generous let one misbehaving app degrade the
shared cluster for everyone.retention_enabled: true from day one, even
if the initial retention period is generous — discovering retention
was never actually enforced after months of unbounded storage growth
is an expensive mistake to unwind.boltdb-shipper index store for any new
deployment — it has better query performance and is the schema Loki
development is focused on going forward.loki_discarded_samples_total by reason as a standing
dashboard panel/alert, not just when someone reports missing logs —
silent ingestion drops are otherwise invisible until someone notices
gaps during an actual investigation.Symptom: Loki's storage (object storage bucket, or local disk in a
small deployment) grows without bound despite a retention_period
being set in config.
Fix: retention_period alone does nothing without the compactor
running with retention_enabled: true and delete_request_store
configured — confirm the compactor component is actually deployed and
its logs show retention sweeps running, not just that the config value
exists.
Symptom: A specific application's logs start being rejected with
429/per-stream rate limit exceeded shortly after a deploy, even
though overall log volume looks normal.
Fix: That app likely just started emitting a new high-cardinality
label (a new field promoted to a label, or a bug causing a unique value
per pod/request), pushing one stream's rate past
per_stream_rate_limit. Check loki_discarded_samples_total{reason= "per_stream_rate_limit"} and the app's label set — fix the label
design at the source rather than raising the limit to accommodate
runaway cardinality.
Symptom: Loki ingesters intermittently lose recent (not-yet-
flushed) log data during pod restarts/rolling upgrades.
Fix: The write-ahead log (WAL) wasn't enabled, or its volume isn't
actually persistent (e.g. backed by ephemeral storage in Kubernetes
instead of a PersistentVolume). Enable ingester.wal.enabled: true
with a real persistent volume backing wal.dir, and confirm
replication_factor is set high enough that a single ingester's loss
doesn't lose data outright.
Symptom: Query performance degrades badly over time as log volume
grows, even though ingestion itself keeps up fine.
Fix: Often an artifact of the older boltdb-shipper index store
under sustained high stream counts, or max_streams_per_user being set
far higher than the label design actually needs. Migrate to TSDB via a
new schema_config entry (never edit the old one) and re-audit label
cardinality.
Symptom: After adding S3 as the storage backend, existing
historical logs ingested under the previous (e.g. filesystem or GCS)
backend become unqueryable.
Fix: A storage_config/object_store change was made by editing
the existing schema_config.configs entry in place instead of adding a
new entry with a future from: date. Add the new backend as a new
dated schema config entry so historical data continues to be read from
its original store while new data lands in the new one.
Symptom: A single noisy tenant/team in a multi-tenant Loki cluster
degrades query latency for every other tenant.
Fix: Per-tenant limits_config overrides weren't set, so one
tenant's oversized queries/high stream count consume shared querier
resources. Set per-tenant overrides (query concurrency, max streams,
ingestion rate) in the runtime overrides config rather than a single
global limit meant to be "generous enough for everyone."
Scenario: Standing up Loki on Kubernetes in simple-scalable mode for a multi-team platform, backed by S3, with a 30-day default retention and a stricter cardinality ceiling after an earlier incident where a team's new field caused stream-count explosion.
# values.yaml (loki-simple-scalable Helm chart, excerpted)
loki:
auth_enabled: true
commonConfig:
replication_factor: 3
schemaConfig:
configs:
- from: 2026-01-01
store: tsdb
object_store: s3
schema: v13
index:
prefix: loki_index_
period: 24h
storageConfig:
aws:
region: <AWS_REGION>
bucketnames: <S3_BUCKET_NAME>
limits_config:
ingestion_rate_mb: 15
ingestion_burst_size_mb: 30
per_stream_rate_limit: 5MB
per_stream_rate_limit_burst: 15MB
max_streams_per_user: 5000
retention_period: 720h
compactor:
retention_enabled: true
delete_request_store: s3
write:
replicas: 3
read:
replicas: 3
Runtime overrides give the payments tenant a longer retention window
for compliance without changing the cluster-wide default:
overrides:
"payments":
retention_period: 2160h
After rollout, loki_discarded_samples_total{reason="per_stream_rate_ limit"} is added as a standing Grafana panel per team namespace so a
repeat of the earlier cardinality incident surfaces immediately instead
of being discovered days later during a query-performance complaint.
loki_discarded_samples_total alerting rules would be wired.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub selvarajmurugesan90/ops-engineering-skills --plugin platform-extras-skills16 skills in this plugin
/backstage-developer-portalGuides building an internal developer portal with Backstage — authoring catalog-info.yaml to register services in the software catalog, setting up TechDocs for docs-as-code, writing Software Templates to scaffold new services, and understanding the plugin architecture. Use when a user asks to "register a service in Backstage", "write a catalog- info.yaml", "set up TechDocs", "create a Backstage software template for scaffolding new repos", "add a Backstage plugin", or "build an internal developer portal."
/distributed-tracing-with-tempo-and-jaegerGuides configuring Grafana Tempo or Jaeger as the distributed tracing backend — trace storage backend selection and retention, sampling strategy at the backend/collector level (head-based vs. tail-based), and trace-to-metrics/trace-to-logs correlation so a trace ID can pivot directly into a log line or a metrics exemplar. Use when the user asks to "set up Tempo," "configure Jaeger storage," "set trace retention," "configure trace-to-logs correlation in Grafana," "design a sampling strategy for traces," or "query traces with TraceQL." This is the tracing *backend/storage* layer — instrumenting applications and configuring the OpenTelemetry Collector that feeds this backend is covered separately in opentelemetry-instrumentation-and-collector-configuration.
Other plugins' skills for the same job