ELK Stack: Components, Setup, Best Practices, and Alternatives

Run the ELK stack in production with a clear component map, setup workflow, operating checklist, monitoring plan, and replacement signals.

Isometric ELK stack pipeline with log shippers, parsing, search storage, dashboards, and a route to OpenTelemetry logs

Contents

Last updated: November 23, 2026

The ELK stack is useful when you need searchable logs and your team is willing to run a search cluster. It is also easy to underestimate: once log volume grows, you are operating Elasticsearch shards, JVM heap, disk watermarks, mappings, Logstash pipelines, Kibana dashboards, and retention policies.

This guide covers what ELK is, how the components fit, how to use ELK Stack in production, the operating checks that keep it healthy, and the point where an OpenTelemetry-native log backend or managed observability platform becomes a better fit.

What is the ELK Stack?

ELK Stack is a log management and search stack made of Elasticsearch, Logstash, and Kibana. Elasticsearch stores and searches JSON documents, Logstash collects and transforms events, and Kibana provides the UI for search, visualization, dashboards, and alerting.

You will also see the term Elastic Stack. That usually means ELK plus adjacent Elastic components such as Beats, Elastic Agent, APM, security features, and integrations. The original acronym still matters because most production log pipelines follow the same shape:

  1. Collect logs from applications, containers, hosts, and cloud services.
  2. Parse, normalize, enrich, or drop events before storage.
  3. Index the resulting documents in Elasticsearch.
  4. Search, chart, alert, and investigate from Kibana.

That workflow is simple to draw and harder to run. ELK works best when you treat it as a production data system, not as a sidecar for logs.

Key elements of the ELK Stack

The stack has three core jobs: search storage, ingestion processing, and exploration. Each component has its own scaling and failure mode.

Elasticsearch

Elasticsearch is a distributed search and analytics engine built on Apache Lucene. It stores data as JSON documents, indexes fields, and lets you run full-text searches, filters, aggregations, and analytics through HTTP APIs. In ELK, Elasticsearch is where parsed log events land.

A typical log document might look like this:

{
"@timestamp": "2026-11-23T10:00:00Z",
"service.name": "checkout-api",
"deployment.environment": "production",
"log.level": "error",
"trace.id": "4bf92f3577b34da6a3ce929d0e0e4736",
"message": "payment provider timeout",
"http.status_code": 504,
"duration_ms": 1500
}

Those fields become useful only if their mappings stay predictable. If one service sends duration_ms as an integer and another sends it as a string, dashboards and aggregations start to break. Elasticsearch is powerful because it indexes many fields; it is also sensitive to field growth, mapping drift, shard layout, heap pressure, and disk pressure.

Logstash

Logstash is a server-side processing pipeline. A Logstash configuration has inputs, filters, and outputs. Inputs receive events, filters parse or mutate them, and outputs send the result to Elasticsearch, S3, another backend, or more than one destination.

A minimal pipeline for application logs looks like this:

input {
beats {
port => 5044
}
}
filter {
grok {
match => { "message" => "%{COMBINEDAPACHELOG}" }
}
date {
match => [ "timestamp", "dd/MMM/yyyy:HH:mm:ss Z" ]
target => "@timestamp"
}
mutate {
add_field => { "deployment.environment" => "production" }
}
}
output {
elasticsearch {
hosts => ["https://elasticsearch.example.internal:9200"]
index => "logs-%{+YYYY.MM.dd}"
}
}

Logstash is useful when logs need parsing, enrichment, routing, redaction, or conditional handling before indexing. It also adds an operating surface: pipeline CPU, persistent queues, plugin versions, backpressure, dead-letter queues, and retry behavior.

Elastic’s Logstash configuration docs cover the file structure and plugin sections in more detail.

Kibana

Kibana is the interface on top of Elasticsearch. Teams use it to search logs, build dashboards, create visualizations, and configure alerts. It supports Kibana Query Language, Lucene syntax, and other Elastic query paths depending on the feature and version.

Kibana is where most users experience ELK, but it is not separate from the underlying data model. Slow dashboards usually come from wide time ranges, expensive aggregations, too many high-cardinality fields, or indices that are not shaped for the query. A clean Kibana experience starts in the ingestion and indexing design.

Elastic’s Kibana setup docs are the right starting point for self-managed installation.

Beats and Elastic Agent

Beats are lightweight shippers that collect logs, metrics, network data, uptime checks, and audit events. Filebeat ships files, Metricbeat ships system and service metrics, Auditbeat ships audit events, Heartbeat checks uptime, and Winlogbeat ships Windows event logs.

Many newer Elastic deployments use Elastic Agent and integrations instead of managing Beats one by one. The job is still the same: collect operational data near the source, add enough metadata to make it searchable, and forward it to Logstash or Elasticsearch.

How to use ELK Stack in production

A local ELK demo proves the pieces can talk. A production ELK Stack needs a pipeline that survives restarts, malformed logs, mapping changes, traffic spikes, and retention pressure.

A practical workflow looks like this:

  1. Decide the log schema. Pick field names for service, environment, severity, trace ID, request ID, status code, user-safe identifiers, and deployment version. Elastic Common Schema is a useful baseline if you are staying in the Elastic ecosystem.
  2. Ship logs from the edge. Use Filebeat, Elastic Agent, Fluent Bit, OpenTelemetry Collector, or another shipper close to the workload.
  3. Parse and enrich before indexing. Use Logstash, ingest pipelines, or Collector processors to normalize timestamps, parse JSON, redact sensitive values, add cloud and Kubernetes metadata, and drop noise.
  4. Write to time-based indices or data streams. Keep recent data fast to search and old data cheaper to retain.
  5. Create index templates. Define field mappings before data arrives so Elasticsearch does not infer conflicting types.
  6. Build Kibana views around incidents. Start with dashboards for error volume, top services, slow endpoints, failed jobs, and security-relevant events.
  7. Alert on patterns that need action. Use thresholds and durations, not single log lines, unless the single event is genuinely critical.

For a local smoke test, use Elastic’s current Elasticsearch installation docs rather than copying an old Docker tag from a blog post. Elasticsearch 8.x and later enable security by default. If you disable security for a local test, keep that setting out of production.

Production security is not optional. Use TLS, authenticated clients, RBAC, audit logging, and network boundaries before letting applications write logs into the cluster.

What else is in the ELK Stack ecosystem?

The ecosystem around ELK exists because logs rarely arrive in the shape you want.

Filebeat is the common choice for tailing application and system log files. It is lightweight and often enough when logs are already structured JSON.

Metricbeat collects system and service metrics. It helps when you want Elasticsearch cluster metrics or host metrics near your logs, although Prometheus remains a more common choice for metrics-first monitoring.

Elastic Agent combines data collection through integrations. It reduces the number of separate Beats processes to manage.

Elastic APM collects traces and application performance data through Elastic agents or OpenTelemetry paths. It is useful if your observability stack is already centered on Elastic.

Ingest pipelines let Elasticsearch process documents before indexing. They can parse, set fields, enrich, and drop fields. For heavy parsing or routing, many teams still prefer Logstash or an external processor so the search cluster does less ingest work.

The rule of thumb: do the cheapest, most deterministic processing as close to the source as possible. Elasticsearch should index searchable events, not repair every upstream logging habit.

Integrating ELK with cloud platforms

Cloud changes how you operate ELK, not whether you operate it.

Self-managed ELK

Self-managed ELK gives you control over versions, topology, plugins, network placement, and storage. It also makes your team responsible for sizing, upgrades, snapshots, shard recovery, security configuration, and incident response.

This model fits teams with strong Elasticsearch experience, strict placement requirements, or workflows that depend on deep Elasticsearch customization.

Managed Elastic

Elastic Cloud runs Elasticsearch and Kibana as a managed service. It removes much of the infrastructure work, but you still need to design indices, control ingest volume, manage mappings, tune dashboards, and understand the resource model you are paying for.

Managed Elastic is often the easiest path if you want Elastic’s full product suite and do not want to operate the underlying cluster yourself.

Amazon OpenSearch Service

Amazon OpenSearch Service runs OpenSearch, the fork that started from Elasticsearch 7.10, and older Elasticsearch OSS versions. It is not the same product line as current Elastic Stack. If you are choosing between them, review licensing, plugin compatibility, query features, managed-service behavior, and migration effort. Our OpenSearch vs Elasticsearch guide covers the fork details.

Cloud log sources

AWS, Azure, and GCP logs can enter ELK through provider integrations, Firehose-style delivery, object storage pipelines, Beats, Logstash, or the OpenTelemetry Collector. The design question is not only “can we ingest this?” It is also:

  • Which fields will we keep?
  • Which fields can become labels or attributes for correlation?
  • Which logs need full-text search?
  • Which logs are compliance records?
  • Which logs are noise after seven days?

Answer those before you size the cluster.

Enterprise setup for ELK Stack

An enterprise ELK setup is mostly about failure isolation. Separate roles, define mappings, keep shards recoverable, and protect the cluster from unbounded queries.

Cluster roles and high availability

A production Elasticsearch deployment usually separates master-eligible nodes, data nodes, ingest nodes, and coordinating nodes as scale grows. Smaller clusters may combine roles, but the goal is the same: prevent one heavy workload from taking down cluster coordination or search.

For availability:

  • Run multiple master-eligible nodes so the cluster can elect a master when a node fails.
  • Use replicas for indices that must stay searchable during node loss.
  • Spread nodes across availability zones where the latency profile supports it.
  • Keep snapshots outside the cluster, and test restore paths.
  • Put Kibana behind an authenticated ingress or load balancer.

Elastic’s docs for high availability and resilience are the better source for topology specifics than a fixed rule copied into every environment.

Heap, shards, and replicas

The most repeated ELK advice is also the easiest to misuse. Heap size, shard size, shard count, and replica count depend on workload, node memory, disk, query shape, and recovery targets.

Use Elastic’s current production guidance for:

  • JVM heap sizing and garbage collection behavior
  • shard sizing and shard count per node
  • disk watermarks and allocation behavior
  • replica counts for availability and search throughput
  • snapshot and restore strategy

Avoid static rules such as “always use N shards” or “heap must be X” unless you can tie them to the current Elastic docs and your workload. Static sizing advice ages quickly.

A minimal production checklist

Before calling the stack production-ready, confirm that you have:

  • TLS on client and node traffic
  • RBAC for Kibana and Elasticsearch access
  • index templates for every log family
  • index lifecycle policies for retention
  • snapshots stored outside the cluster
  • restore tests on a schedule
  • dashboards for cluster health, indexing, search latency, heap, disk, and queue pressure
  • alerts for red cluster state, disk pressure, sustained heap pressure, rejected thread-pool tasks, and failed indexing
  • runbooks for shard recovery, mapping conflicts, stuck pipelines, and slow dashboards

That checklist matters more than a long install guide.

ELK Stack best practices

Most ELK problems start upstream. The cluster is asked to store inconsistent, high-volume, low-value logs and then answer broad queries across long time ranges.

Use structured logs

Prefer JSON logs with consistent field names. Include service.name, deployment.environment, log.level, @timestamp, trace.id, span.id, request.id, and version metadata where available. Avoid mixing names such as userId, user_id, and userid across services.

Structured logs reduce Grok work, mapping conflicts, and search guesswork.

Keep mappings predictable

Define index templates before production traffic arrives. Use keyword for exact-match fields, numeric types for numbers, date for timestamps, and text only where full-text search is needed.

Do not index every nested payload by default. Wide logs can hit field limits, slow queries, and make dashboards harder to maintain.

Use lifecycle policies

Logs age quickly. Keep hot data on fast storage, move older data to cheaper tiers if your deployment supports it, and delete data when retention expires. Retention should come from debugging needs, compliance needs, and cost, not from the hope that every log may matter later.

Control query scope

Teach users to filter by time, service, severity, environment, and request identifiers before running broad searches. In Kibana, dashboards should default to practical time windows and avoid unbounded terms aggregations on high-cardinality fields.

Keep parsing observable

Monitor Logstash pipeline throughput, filter failures, persistent queue growth, and dead-letter queues. A green Elasticsearch cluster does not mean your log pipeline is healthy. A parser can silently drop, misread, or delay the logs you need during an incident.

Protect sensitive data

Redact tokens, secrets, payment data, and personal data before indexing. Once sensitive content lands in searchable logs, you have an access-control and retention problem. Treat redaction as an ingestion requirement, not a dashboard preference.

Monitoring and maintenance of ELK Stack

You need to monitor ELK as a production system. Start with Elasticsearch, then Logstash, then Kibana usage and dashboard performance.

For Elasticsearch, watch:

  • cluster health and unassigned shards
  • node count and master changes
  • JVM heap usage and garbage collection pauses
  • disk usage and disk watermarks
  • indexing rate and indexing failures
  • search latency and search error rate
  • thread-pool queue size and rejections
  • circuit breaker trips
  • snapshot success and restore test status

For Logstash, watch:

  • events in, filtered, and out
  • pipeline latency
  • CPU and heap usage
  • persistent queue depth
  • plugin failures and retry loops
  • dead-letter queue growth

For Kibana, watch:

  • slow dashboards
  • saved object changes
  • user-facing errors
  • alert execution failures
  • long-running or expensive queries

Our Elasticsearch metrics guide covers the cluster-level metrics in more detail.

Maintenance should include version planning, snapshot restore tests, index template reviews, lifecycle policy reviews, dashboard cleanup, slow-query analysis, and parsing-rule tests. Add these to an operations calendar. If they happen only after an outage, the stack will drift.

When the ELK Stack is a good fit

ELK remains a strong fit when logs are your primary workflow and search depth matters.

Choose ELK when:

  • your team needs full-text search over large log bodies
  • you already have Elasticsearch expertise
  • Kibana is the team’s main investigation interface
  • Elastic Security or other Elastic features are part of the same program
  • you need deep control over index design, analyzers, ingest pipelines, or query behavior
  • the team has time to operate shards, mappings, lifecycle policies, and upgrades

ELK is not automatically wrong because it takes work. For teams that need search as a primary capability and have the skills to run it, that work can be worth it.

When to replace or complement ELK

Do not replace ELK just because a newer tool exists. Replace or complement it when the operating model no longer matches the work your team needs to do.

Common signals include:

  • Operations load: SREs spend more time on shard recovery, heap pressure, mappings, and upgrades than on incident response.
  • Correlation gaps: Logs, metrics, and traces live in separate tools, so every incident requires manual tab switching and timestamp matching.
  • Field growth: New services add fields faster than your mapping strategy can absorb.
  • Cost pressure: Retention, replicas, hot storage, and query capacity grow faster than the value of the logs being kept.
  • Pipeline sprawl: Logstash rules, Beats configs, ingest pipelines, and dashboard assumptions diverge across teams.
  • OpenTelemetry adoption: Your services already emit OTLP metrics, logs, and traces, and you want one telemetry path instead of a log-only island.

If you are evaluating replacements, use our ELK Stack alternatives comparison for the tool list. If the decision is specifically OpenTelemetry versus ELK, read OpenTelemetry vs ELK.

Last9 is a fit when you want logs, metrics, and traces in one OpenTelemetry-native workflow rather than a search cluster operated by your team. The Logs docs cover log exploration, Builder mode, LogQL-compatible Editor mode, related logs, traces, and metrics. For teams moving from Elastic, Last9 vs Elasticsearch documents the deployment, field-limit, query, and migration differences. For a real migration, see how Housing.com replaced its ELK stack with Last9.

If you still need Elasticsearch for full-text search or security analytics, keep it for that job and send operational telemetry to a backend built around OpenTelemetry. Replacement does not have to be a flag day.

FAQ

What is ELK Stack?

ELK Stack is a log management and search stack made of Elasticsearch, Logstash, and Kibana. Elasticsearch stores and searches JSON documents, Logstash collects and transforms events, and Kibana provides the UI for search, visualization, dashboards, and alerting.

How do you use ELK Stack?

Use ELK Stack by shipping logs from applications and infrastructure, parsing or enriching them in Logstash or Beats, indexing them in Elasticsearch, and querying or visualizing them in Kibana. Production use also needs index lifecycle policies, access control, backups, and cluster monitoring.

What are ELK Stack best practices?

The most useful ELK Stack best practices are structured logging, consistent mappings, time-based indices, index lifecycle management, RBAC, encrypted transport, heap and disk monitoring, query limits, and regular restore tests. Keep parsing close to ingestion so Elasticsearch receives predictable fields.

When should you replace ELK Stack?

Consider replacing or complementing ELK Stack when your team spends too much time on shards, heap, mappings, upgrades, and query tuning; when logs need tighter correlation with metrics and traces; or when telemetry volume and infrastructure cost grow faster than your team can operate.

What are ELK Stack alternatives?

ELK Stack alternatives include OpenSearch, Grafana Loki, Graylog, Splunk, and OpenTelemetry-native observability platforms such as Last9. The right choice depends on whether you need full-text search, security analytics, low-cost log retention, or logs correlated with metrics and traces.

About the authors
Anjali Udasi

Anjali Udasi

Helping to make the tech a little less intimidating. I

Last9 logo and enter key

Start observing for free. No lock-in.

OpenTelemetry · Prometheus

Just update your config. Start seeing data on Last9 in seconds.

Datadog · New Relic · Others

We've got you covered. Bring over your dashboards & alerts in one click.

Built on Open Standards

100+ integrations. OTel native, works with your existing stack.