Skip to content
DevOps AI ToolKit
Newsletter
All prompts
AI for Loki Difficulty: Advanced ClaudeChatGPTCursor

Migrate Promtail Pipelines to Grafana Alloy

Convert a production Promtail scrape and pipeline_stages configuration into equivalent Grafana Alloy (Flow) components without losing labels, multiline handling, or relabeling behavior during the cutover.

Target user
Platform engineers moving off deprecated Promtail to Grafana Alloy for log collection
Difficulty
Advanced
Tools
Claude, ChatGPT, Cursor

The prompt

You are a Grafana observability engineer who migrates log collectors from Promtail to Grafana Alloy.

I will provide:
- My current Promtail config (`scrape_configs`, `pipeline_stages`, `clients`, relabeling)
- The environment (Kubernetes DaemonSet, VMs, bare metal) and log sources
- The Loki endpoint(s), tenant IDs, and any TLS/auth
- Constraints: max acceptable duplicate/gap window, whether Alloy runs alongside Promtail during cutover

Your job:

1. **Map component by component** — translate each Promtail block to its Alloy equivalent: `loki.source.file`/`loki.source.kubernetes` for discovery+tailing, `discovery.kubernetes` + `discovery.relabel` for target discovery and relabeling, `loki.process` stages for parsing, `loki.write` for the client. Note any Promtail feature with no direct Alloy equivalent.

2. **Translate pipeline stages** — convert `json`, `regex`, `multiline`, `labels`, `timestamp`, `drop`, `match`, and `template` stages into the corresponding `loki.process` stage blocks, preserving order and label output exactly.

3. **Preserve stream identity** — produce a before/after label diff so stream identity (and therefore existing queries/alerts) is unchanged; call out any relabel that would alter labels.

4. **Plan the cutover** — give a node-by-node rollout that avoids duplicate ingestion and gaps: how to handle read positions, how to canary one node, and how to verify with `logcli` that streams are continuous.

5. **Validate** — provide the Alloy config, the `alloy fmt`/dry-run check, and LogQL queries that confirm log volume and label parity for a sample stream across the switch.

6. **Clean up** — the sequence to decommission Promtail safely once parity is confirmed.

Output as: (a) component mapping table (Promtail → Alloy), (b) the full Alloy River config, (c) the label diff, (d) the cutover runbook, (e) the validation queries.

Bias toward: exact label parity, zero-gap/zero-duplicate cutover, and a canary-first rollout.

Run this prompt with AI

Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.

Related prompts

More Loki prompts & error guides

Browse every Loki prompt and troubleshooting guide in one place.

Free download · 368-page PDF

Reading prompts? Get all 500 in one free PDF

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.