Architecting the Elastic Stack: A Comprehensive Guide to Enterprise Centralized Logging and Data Visualization

The Elastic Stack, historically and widely recognized as the ELK Stack, represents a sophisticated ecosystem of open-source software engineered by Elastic to facilitate the real-time search, analysis, and visualization of logs generated from any source and in any format. At its core, the stack implements a philosophy of centralized logging, a critical architectural pattern in modern DevOps and system administration. By consolidating logs from disparate servers, containers, and applications into a single, searchable repository, organizations can move away from the inefficient practice of manual log inspection via SSH across multiple machines. This centralization is paramount for identifying systemic failures or performance bottlenecks that span multiple server nodes, as it allows administrators to correlate events across a specific time frame using a unified temporal index.

The power of the Elastic Stack lies in its ability to ingest massive volumes of data, process that data into a searchable format, and then present that data through a visual interface that transforms raw logs into actionable business intelligence. Whether deploying on a single Ubuntu server for development or utilizing a distributed cluster across AWS and GCP via Elastic Cloud, the objective remains the same: achieving total observability of the digital infrastructure.

The Core Components of the Elastic Stack

The architecture of the Elastic Stack is composed of four primary pillars, each serving a distinct role in the data pipeline from ingestion to visualization.

  • Elasticsearch: This is the heart of the stack. It is a distributed, RESTful search and analytics engine that stores the data. Built on Java and including a bundled version of OpenJDK, it provides the indexing and search capabilities required to query terabytes of data in near real-time.
  • Logstash: This component serves as the server-side data processing pipeline. It ingests data from multiple sources, transforms it (parsing, filtering, and enriching), and then sends it to a "sink," most commonly Elasticsearch.
  • Kibana: This is the visualization layer. It provides a web interface that allows users to create dashboards, charts, and maps based on the data indexed in Elasticsearch. Because it is a window into the data, it requires a direct connection to the Elasticsearch REST API.
  • Beats: These are lightweight data shippers. Unlike Logstash, which is a full-featured processing engine, Beats are small agents installed on the edge (the servers being monitored). An example is Filebeat, which is specifically used for forwarding and centralizing logs and files.

Critical Versioning and Compatibility Requirements

One of the most stringent requirements when deploying the Elastic Stack is the mandate for version parity across the entire ecosystem.

The technical requirement is absolute: you must use the exact same version for every component in the stack. This is not a recommendation but a necessity for API compatibility and data schema consistency. For instance, if an administrator chooses to deploy Elasticsearch version 9.3.3, then every other component must match this version precisely.

  • Beats: Must be version 9.3.3
  • APM Server: Must be version 9.3.3
  • Elasticsearch Hadoop: Must be version 9.3.3
  • Kibana: Must be version 9.3.3
  • Logstash: Must be version 9.3.3

Alternatively, in older deployments such as version 7.17.29, the same rule applies: every component from the APM Server to Logstash must be 7.17.29. Failure to maintain this parity often leads to "version mismatch" errors in the logs and can prevent Kibana from communicating with the Elasticsearch cluster. For those upgrading from an existing installation, it is imperative to consult the "Upgrade your deployment, cluster, or orchestrator" documentation (for 9.3.3) or the "Upgrading the Elastic Stack" guide (for 7.17.29) to ensure the migration path is compatible.

Deployment Strategies and Environments

Depending on the scale of the operation and the available resources, there are three primary ways to deploy the Elastic Stack.

Self-Managed On-Premise or VPS Deployment

For those seeking total control over their data and infrastructure, a self-managed installation on a Linux distribution like Ubuntu 22.04 is common. This approach requires the administrator to handle all aspects of the installation, including OS tuning, security, and networking.

A typical entry-level setup on Ubuntu 22.04 requires the following minimum hardware specifications:

  • CPU: 2 Cores
  • RAM: 4GB
  • User Access: A non-root sudo user

It is important to note that these are the minimum requirements to get the services running. The actual CPU, RAM, and storage requirements will scale linearly with the volume of logs being ingested. High-volume environments will require significantly more resources to prevent the Java Virtual Machine (JVM) from crashing due to Out-of-Memory (OOM) errors.

Containerized Deployment via Docker

For developers and those utilizing microservices architectures, Docker provides a streamlined path to deployment. Container images for all Elastic components are available through the Elastic Docker Registry.

To deploy multiple nodes simultaneously and manage the networking between them, Docker Compose is the recommended tool. This allows for the definition of the entire stack in a single YAML file, ensuring that the network aliases for Elasticsearch, Logstash, and Kibana are correctly mapped.

Managed Cloud Deployment (Elastic Cloud)

The Elasticsearch Service on Elastic Cloud is the official hosted offering provided by Elastic, available on both Amazon Web Services (AWS) and Google Cloud Platform (GCP). This is the "single-click" approach to deployment.

  • Deployment Speed: A cluster can be created with a single click, with options for high availability (HA) built-in.
  • Integrated Features: Subscription features, security, and monitoring are automatically installed.
  • Kibana Integration: Kibana can be enabled on a cluster with a single click, and popular plugins are available for immediate use.
  • Pricing: Certain advanced features are locked behind specific subscription tiers, which are detailed on the official pricing page.

Detailed Installation Sequence and Dependencies

When deploying a self-managed cluster, the order of installation is critical. Installing components in the wrong order can lead to configuration failures because certain products depend on the existence of others.

The mandatory installation order is as follows:

  1. Elasticsearch: Must be installed first because it is the data store. Every other component depends on the Elasticsearch REST API to function.
  2. Kibana: Installed second so it can be linked to the running Elasticsearch instance for configuration.
  3. Logstash: Installed third to begin processing and routing data into the established Elasticsearch index.
  4. Beats (e.g., Filebeat): Installed last, as they are the edge shippers that send data to Logstash or Elasticsearch.

A critical security consideration for production environments involves the use of Certificate Authorities (CA). If you plan to use trusted CA-signed certificates for Elasticsearch, these must be configured before deploying Fleet and Elastic Agent. If security certificates are changed or updated after the agents are installed, the Elastic Agents must be completely reinstalled to recognize the new trust chain.

Network Configuration and Port Management

For the Elastic Stack to be functional, specific network ports must be opened and accessible. If the cluster is deployed across multiple servers, firewalls must be configured to allow traffic on these ports.

The following table details the mandatory port requirements:

Port Access Type Purpose Setting
9200 and onwards HTTP (REST) Primary interface for external access, used by Kibana and Logstash to communicate with the cluster. Elasticsearch http.port
9300 and onwards TCP Transport API used for communication between nodes within the cluster and Java clients. Elasticsearch transport.port
5601 HTTP Default access port for the Kibana web interface. Kibana server.port

By default, Elasticsearch attempts to listen on the first port in the specified range. If that port is already occupied by another process, it will automatically try the next available port. These behaviors can be modified in the respective configuration files if a specific port is required for organizational compliance.

Crucially, the Elasticsearch REST and Kibana interfaces must be open to external users for the cluster to be usable. However, exposing these ports directly to the public internet is a severe security risk.

Implementing Security and Reverse Proxies

Because the Elastic Stack contains sensitive system logs and potentially private data, security is paramount.

TLS/SSL Encryption

It is highly recommended to install TLS/SSL certificates to encrypt the traffic between the user's browser and the server. This prevents man-in-the-middle attacks and ensures that the administrative credentials used to access Kibana are not transmitted in plain text.

Nginx as a Reverse Proxy

By default, Kibana is often only available on the localhost. To make it accessible over a web browser while maintaining security, Nginx is used as a reverse proxy. Nginx sits in front of Kibana, handling the external HTTP requests and forwarding them to the Kibana service on port 5601. This allows for the implementation of custom domain names and the termination of SSL certificates at the Nginx level.

Configuring Filebeat for Log Shipping

Filebeat is the most common "Beat" used for collecting system logs. Once the core stack is running, Filebeat must be configured to ship logs to Logstash or Elasticsearch.

During the setup process, certain configurations are required to enable index lifecycles and dashboards. Specifically, the setting setup.ilm.overwrite:true should be used to enable the Index Lifecycle Management (ILM) overwrite.

The typical setup flow for Filebeat involves:

  1. Loading dashboards (this requires Kibana to be running and reachable).
  2. Loading machine learning job configurations (Note: using setup --machine-learning is deprecated and will be removed in version 8.0.0 in favor of the ML app).
  3. Loading ingest pipelines.

Once the configuration is complete, Filebeat is started and enabled using the following system commands:

bash sudo systemctl start filebeat

bash sudo systemctl enable filebeat

Verifying the Installation and Data Flow

After the components are active, it is necessary to verify that the data pipeline is functioning. The expected flow of data is:
System Logs -> Filebeat -> Logstash -> Elasticsearch -> Kibana.

To verify that Elasticsearch is successfully receiving data from Filebeat, an administrator can query the Filebeat index directly using a curl command:

bash curl -XGET 'http://localhost:9200/filebeat-*/_search?pretty'

A successful response will return a JSON object containing the search hits, confirming that the logs are being indexed and are available for visualization in Kibana.

Conclusion: An Analytical Overview of Elastic Stack Deployment

Deploying the Elastic Stack is an exercise in balancing resource allocation, version synchronization, and network security. The transition from the legacy "ELK" terminology to the "Elastic Stack" reflects the evolution of the ecosystem from three disparate tools to a cohesive platform including Beats and APM servers.

The most significant failure point in these deployments is usually version mismatch or improper port configuration. By adhering to the strict requirement of version parity—ensuring that every component from the JVM-based Elasticsearch engine to the lightweight Filebeat shipper shares the exact same version number—administrators can avoid the most common integration errors.

Furthermore, the choice between self-managed deployment and Elastic Cloud represents a trade-off between control and convenience. While the cloud offering simplifies the complex process of high-availability configuration and security patching, the self-managed route on Ubuntu 22.04 provides a deeper understanding of the underlying JVM tuning and network architecture. Ultimately, the successful implementation of this stack allows an organization to transform raw, unstructured log data into a powerful diagnostic tool, reducing the Mean Time to Resolution (MTTR) for production incidents through the power of centralized, real-time search.

Sources

  1. Installing Elasticsearch
  2. How to Install Elasticsearch, Logstash, and Kibana (ELK Stack) on Ubuntu 22.04
  3. Installing Elastic Stack 7.17
  4. Collecting and Visualizing Logs with Elastic Stack

Related Posts