• Home
  • /
  • Blog
  • /
  • Why I Told a Client to Swap Elasticsearc...
Blog

Why I Told a Client to Swap Elasticsearch for Grafana Loki at 120 GB of Logs a Day

Bar chart: logging costs per month on Google Cloud, Elasticsearch about €2,230 vs. Grafana Loki about €670, saving about €1,560

Why I Told a Client to Swap Elasticsearch for Grafana Loki at 120 GB of Logs a Day

By Walid El Sayed Aly 25 Nov 2026

A client of mine runs their platform on GKE and generates about 120 GB of logs a day. Everything went into a self-hosted Elasticsearch cluster, and over time that cluster quietly turned into one of the biggest items on their monthly Google Cloud bill. I told them to switch to Grafana Loki.

Using Frankfurt (europe-west3) list prices, the change comes out to a bit over €1,500 saved every month, so somewhere around €18,000 a year. The developers were mostly worried about losing Kibana search, which makes sense, but for the kind of debugging they actually do day to day it held up just fine. The Helm values and Alloy config are further down if you want to skip straight to the setup.

Where we started

Nothing was actually broken in the old setup, it was just expensive for how the team used it. They had a pretty standard self-hosted Elasticsearch cluster on GKE with three data nodes at 64 GB RAM each, half of that reserved for the JVM heap, plus a separate node for Kibana and ingestion. To keep 30 days of logs with one replica per shard and enough headroom before Elasticsearch's disk watermarks start complaining, they were paying for roughly 8 TB of persistent disk.

Nobody really looked at the cost for a while until a Compute Engine invoice came in way above what they had budgeted. When we pulled up Google Cloud Billing and broke the spend down by service and SKU, the VMs and disks for Elasticsearch sat near the top of the whole platform, ahead of a few services that actually bring in revenue.

What made it harder to justify was how people searched. Almost every query started with a namespace or a service name anyway, so the full-text index underneath was doing a lot of work for searches nobody was running. On top of that, Prometheus and Grafana were already in place for metrics, which meant jumping over to Kibana in another tab whenever something broke.

Why Loki made sense here

Elasticsearch builds a full inverted index across every field of every log line, and all of that has to sit on fast block storage with a replica beside it. Loki skips most of that. It only indexes a handful of labels per stream, things like namespace and app, while the actual log lines get compressed into chunks and dropped into a Google Cloud Storage bucket. When someone wants to see the errors from checkout in prod over the last hour, Loki filters by those labels first and scans the matching chunks in parallel. Instead of paying for terabytes of replicated persistent disk, you end up with a few hundred gigabytes in GCS, and Google handles durability for you.

Getting everything into Grafana was almost as big a win as the bill. Because Prometheus was already wired up, an alert firing on a latency panel can link straight to the logs for the exact same pods and time window, so whoever is on call doesn't have to reconstruct the timestamp in Kibana in the middle of an incident. Maintenance also got noticeably quieter without shard sizing or JVM heap tuning to babysit, and retention comes down to a single config flag in the compactor.

Costs

On paper the difference works out to around €1,560 a month. I built the estimate for 120 GB a day with 30 days retention on GKE in europe-west3, using on-demand list prices converted at roughly €0.87 per USD.

Monthly cost breakdown: Elasticsearch vs. Grafana Loki on GCP
Monthly cost breakdown: Elasticsearch vs. Grafana Loki on GCP

With best_compression turned on, Elasticsearch usually sits close to the raw log volume on disk, so 3.6 TB a month doubles to 7.2 TB once you add the replica, and then you need roughly 15 % headroom on top. That calculation already assumes pd-balanced at $0.12 per GB in Frankfurt. If the cluster is on pd-ssd at $0.204 per GB instead, the Elasticsearch bill climbs by another €600 or so (pd-ssd, pd-balanced).

On the Loki side I went with an 8x compression ratio, which is fairly conservative for JSON logs. Even if compression turns out half as good at 4x, the GCS bucket only goes up by about €10 a month because storage barely moves the needle compared to the compute nodes. Committed use discounts will knock 30 to 50 % off the compute lines on both sides, which narrows the gap a bit, though you are still looking at over €1,000 saved each month.

Search

In practice, search felt just as fast as Kibana, and for normal debugging people often got to the right lines quicker. Most of that comes from keeping the label setup tight rather than anything magical about Loki.

We only put namespace, app, container and level into labels and leave everything else out. With a few gigabytes per service per hour, filtering down to those streams already gets rid of almost all the noise. Since the apps log JSON, LogQL can still parse and filter fields pretty much the way everyone was used to in Kibana.

{namespace="prod", app="checkout"} |= "PaymentDeclined" | json | status >= 500

Anything with high cardinality, like trace_id or request_id, goes into structured metadata instead. That keeps the index from blowing up while still letting you filter directly on a trace ID.

{namespace="prod"} | trace_id="4bf92f3577b34da6a3ce929d0e0e4736"

Under the hood, queries get split by time range and spread across the read pods in parallel. Putting Memcached in front as a results cache also helps during an incident, because the second engineer opening the same dashboard doesn't wait for the chunks to be scanned again. Getting comfortable with LogQL took the team around two months. People were used to dropping a search term into one big box in Kibana, so picking labels first and narrowing down from there took a while to stick.

There is one real limit worth calling out. If you want to search for an arbitrary string across every namespace over the full 30 days with no labels at all, Elasticsearch is still faster. Loki had bloom filters aimed at that exact problem, which were experimental in 3.x, and the current docs already list them as deprecated (Loki docs). I didn't touch them for this setup, and honestly that kind of blind full-cluster search barely happened here anyway.

Loki on GKE with Helm

We deployed the official grafana/loki Helm chart in Simple Scalable mode. It separates Loki into write, read and backend pods that you can scale independently, which is more than enough at 120 GB a day. Full microservices mode adds a lot of moving parts and isn't really worth the trouble until you're way past this volume.

Chunks and indexes go straight to GCS via Workload Identity, so we don't have to manage static service account keys inside the cluster. The bucket and project names below are placeholders.

values-loki.yaml
# helm install loki grafana/loki -n loki -f values-loki.yaml deploymentMode: SimpleScalable loki: auth_enabled: false schemaConfig: configs: - from: "2026-01-01" store: tsdb object_store: gcs schema: v13 index: prefix: loki_index_ period: 24h storage: type: gcs bucketNames: chunks: acme-loki-chunks ruler: acme-loki-ruler admin: acme-loki-admin limits_config: retention_period: 720h # 30 days allow_structured_metadata: true ingestion_rate_mb: 20 # default of 4 MB/s is too low for peaks ingestion_burst_size_mb: 40 per_stream_rate_limit: 10MB max_query_parallelism: 64 split_queries_by_interval: 1h volume_enabled: true compactor: retention_enabled: true delete_request_store: gcs serviceAccount: create: true annotations: iam.gke.io/gcp-service-account: loki@acme-prod.iam.gserviceaccount.com write: replicas: 3 persistence: size: 50Gi storageClass: standard-rwo # pd-balanced on GKE resources: requests: { cpu: "1", memory: 4Gi } limits: { memory: 6Gi } read: replicas: 3 resources: requests: { cpu: "1", memory: 2Gi } limits: { memory: 4Gi } backend: replicas: 2 persistence: size: 50Gi storageClass: standard-rwo chunksCache: enabled: true allocatedMemory: 8192 # MB resultsCache: enabled: true allocatedMemory: 1024 minio: enabled: false

On the GCP side, the Google service account needs roles/storage.objectAdmin on those buckets, and the Kubernetes service account needs permission to impersonate it.

gcloud iam service-accounts add-iam-policy-binding \
  loki@acme-prod.iam.gserviceaccount.com \
  --role roles/iam.workloadIdentityUser \
  --member "serviceAccount:acme-prod.svc.id.goog[loki/loki]"

Two things in that values file are easy to miss if you go with the defaults. 120 GB a day averages out to roughly 1.4 MB/s, while Loki's default per-tenant ingestion limit sits at 4 MB/s, so a deploy or a brief error spike blows past it fast and Alloy starts eating 429s. The other one is retention_enabled on the compactor. Setting retention_period alone doesn't delete anything, so your bucket will just keep filling up if you forget that flag.

Grafana Alloy

Alloy runs as a DaemonSet and reads container log files directly off each node. I'd much rather do that than tail logs through the Kubernetes API, because at 120 GB a day the API server really starts feeling that traffic. The pipeline block inside the Helm values uses Alloy's own config syntax.

values-alloy.yaml
# helm install alloy grafana/alloy -n loki -f values-alloy.yaml controller: type: daemonset alloy: mounts: varlog: true configMap: content: | discovery.kubernetes "pods" { role = "pod" selectors { role = "pod" field = "spec.nodeName=" + sys.env("HOSTNAME") } } discovery.relabel "pods" { targets = discovery.kubernetes.pods.targets rule { source_labels = ["__meta_kubernetes_namespace"] target_label = "namespace" } rule { source_labels = ["__meta_kubernetes_pod_label_app_kubernetes_io_name"] target_label = "app" } rule { source_labels = ["__meta_kubernetes_pod_container_name"] target_label = "container" } rule { source_labels = ["__meta_kubernetes_pod_uid", "__meta_kubernetes_pod_container_name"] separator = "/" target_label = "__path__" replacement = "/var/log/pods/*$1/*.log" } } local.file_match "pods" { path_targets = discovery.relabel.pods.output } loki.source.file "pods" { targets = local.file_match.pods.targets forward_to = [loki.process.pods.receiver] } loki.process "pods" { stage.cri {} stage.json { expressions = { level = "level", trace_id = "trace_id" } } stage.labels { values = { level = "" } } stage.structured_metadata { values = { trace_id = "" } } forward_to = [loki.write.default.receiver] } loki.write "default" { endpoint { url = "http://loki-gateway.loki.svc.cluster.local/loki/api/v1/push" } }

The split in loki.process is the part that matters most here. Putting level into labels is harmless because you only ever have maybe five distinct values. trace_id changes on every request, so if that accidentally lands in labels instead of structured metadata, each request spawns a new stream and your index blows up within a few hours.

What to watch out for

Bad labels are still the fastest way to break a Loki cluster. Someone adds user_id or a pod IP as a label because it feels convenient, and before long you have millions of tiny streams eating all the ingester memory while queries grind to a halt. Putting a short label rule into the team's logging guidelines and catching changes in code review saves a lot of pain later.

People also tend to miss inter-zone egress on GCP when they only compare disk and bucket prices. With a replication factor of 3, each log line crosses zones twice. At 120 GB a day that adds roughly €60 a month in the table above, not huge on its own, just something worth having in the spreadsheet so nobody is surprised later.

If you do make the move, plan on running both stacks in parallel for two or three weeks before shutting Elasticsearch down. The older logs stay in Kibana until retention clears them out, and developers can pick up LogQL at their own pace without being forced onto it during an outage.

Loki isn't the right call everywhere. I'd stick with Elasticsearch if the same cluster also runs product search in an app or works as a SIEM where security teams need wide ad-hoc full-text queries across everything. Heavy aggregations across lots of fields are another case where Elasticsearch still earns its keep, since Loki can run metric queries over logs but wasn't really designed around that workload.

If you're running a similar Elasticsearch setup on GCP or AWS and wondering whether the numbers work out for your volume, feel free to reach out and we can walk through your bill together.

Sources

Share: