Migrate application logs from a self-hosted ELK stack to Grafana Loki. How do you do it without losing logs?
IntermediateScenarioMigrations
Answer
Situation read → ELK is usually being replaced because of cost and operational load (JVM heap, shard tuning). The risk is a gap in logs during the switch, and dashboards and alerts that silently stop working.
What I'd do →
- Inventory what depends on Elasticsearch: Kibana dashboards, saved searches, alert rules, and anyone querying the API directly.
- Dual-ship first. Point the collector (Fluent Bit, Vector or Grafana Alloy) at both outputs so Loki fills up while ELK stays the source of truth.
[OUTPUT]
Name loki
Match kube.*
Host loki-gateway.monitoring.svc
Port 80
Labels job=fluent-bit, namespace=$kubernetes['namespace_name'], app=$kubernetes['labels']['app']
- Design labels carefully: low cardinality only (namespace, app, env). Never put request IDs or user IDs in labels; Loki indexes labels, not content.
- Rebuild the top dashboards and alerts in LogQL, and have each team sign off on theirs.
- Run both for one full retention window, then stop shipping to ELK and keep a snapshot of the old indices in S3 for compliance.
Why → Dual-shipping removes the "gap" risk and lets you compare query results side by side before cutting over.
Interview tip → Say "Loki indexes labels, not log lines", and explain that high-cardinality labels are the most common way to break it.
More on Migrations
Migrate an application from EC2 to EKS with zero downtime. Walk me through it.AdvancedMigrate a database from on-prem MySQL to Amazon RDS with minimal downtime. How?AdvancedYou need to move Terraform state from local files to an S3 backend. How?BeginnerMigrate CI from Jenkins to GitHub Actions for 80 repositories. How do you plan it?IntermediateUpgrade an EKS cluster from 1.30 to 1.31 in production. What's your process?IntermediateMove from a monolith to microservices. What's the DevOps side of the migration?Advanced