Interview Prep/Monitoring & Observability/Logging: Loki, Fluent Bit and Elasticsearch

Elasticsearch cluster health is `red`

IntermediateTroubleshootingLogging: Loki, Fluent Bit and Elasticsearch
Answer

Likely causes → At least one primary shard is unassigned: node lost with no replica, disk watermark reached, or corrupted shard.

Diagnose →

curl -s es:9200/_cluster/health?pretty
curl -s 'es:9200/_cat/shards?v&h=index,shard,prirep,state,unassigned.reason' | grep UNASSIGNED
curl -s es:9200/_cluster/allocation/explain?pretty

Fix → Act on the explain reason: bring back the node, free disk, or POST _cluster/reroute?retry_failed=true. As a last resort for lost primaries, allocate_empty_primary (data loss) or restore from snapshot.

Prevent → At least 1 replica, snapshot lifecycle policies, disk alerts.

All Monitoring & Observability questions Roadmap: Logging & tracing

More on Logging: Loki, Fluent Bit and Elasticsearch