Architecting the Elastic Stack: A Comprehensive Guide to Self-Managed Deployment and Observability

The Elastic Stack, commonly referred to as the ELK Stack, represents a sophisticated ecosystem designed for the ingestion, storage, analysis, and visualization of massive volumes of data in real-time. At its core, the stack is engineered to provide a distributed search and analytics engine capable of handling everything from simple text searches to complex geospatial data processing and Application Performance Monitoring (APM). The architectural philosophy of the stack centers on scalability and resilience, leveraging a distributed nature to ensure high availability and performance consistency even as data volumes grow exponentially. By integrating components such as Elasticsearch, Logstash, Kibana, and the newer Elastic Agent and Fleet Server framework, organizations can transition from raw, unstructured log data to actionable operational intelligence. This guide provides an exhaustive technical deep dive into the deployment of version 9.3.3 of the Elastic Stack in a self-managed environment, focusing on a three-node cluster configuration and the implementation of a secure-by-default infrastructure.

Core Architectural Components of the ELK Ecosystem

The Elastic Stack is not a single application but a suite of integrated tools, each serving a distinct role in the data pipeline.

Elasticsearch serves as the heart of the stack. It is a real-time, distributed storage, search, and analytics engine built upon Apache Lucene. Lucene provides the high-performance, full-featured text search engine library that allows Elasticsearch to index data efficiently. By extending Lucene's capabilities, Elasticsearch introduces a distributed search engine with an HTTP web interface and utilizes schema-free JSON documents. This schema-less nature allows users to store a variety of structured and unstructured data without predefined tables, making it ideal for rapidly evolving data types. The distributed nature of Elasticsearch means that data and query loads are spread across all nodes in a cluster, which eliminates single points of failure and ensures that the system can scale horizontally to meet increasing demand.

Logstash acts as the primary data processing pipeline. It is a specialized tool for managing events and logs, capable of ingesting data from a diverse array of sources, including web servers, cloud services, and local log files. Logstash does not merely move data; it transforms it. Through its flexibility, it can parse, enrich, and format data before sending it to a destination, such as Elasticsearch. This transformation layer is critical for converting raw, unstructured logs into a structured format that Elasticsearch can index and query efficiently.

Kibana provides the visualization and management layer. It is the window through which users interact with the data stored in Elasticsearch. Through the Kibana web interface, users can utilize the Discover feature to analyze log data in real-time or leverage pre-built dashboards to visualize system activity. Kibana also serves as the administrative hub for managing the Fleet Server and configuring Elastic Agents.

Implementation of a Self-Managed Elastic Stack 9.3.3

Deploying a self-managed cluster requires a precise coordination of hosts and network connectivity. The standard professional deployment for a robust environment typically involves a three-node Elasticsearch cluster to ensure quorum and data redundancy.

Infrastructure Requirements and Network Mapping

A successful installation requires a clear mapping of host names and IP addresses to ensure that components can communicate securely. The following table outlines the exemplary network architecture for a standard deployment.

Component Example Host Name Example IP Address
Elasticsearch Node 1 instance-1 203.0.113.21
Elasticsearch Node 2 instance-2 203.0.113.22
Elasticsearch Node 3 instance-3 203.0.113.23
Kibana kibana-host 203.0.113.31
Fleet Server fleet-server-host 203.0.113.41

The use of three separate nodes for Elasticsearch is a technical requirement for maintaining cluster health and avoiding the "split-brain" scenario, where nodes cannot agree on the state of the cluster.

Package Selection and Installation Strategy

For the deployment of the Elastic Agent and Fleet Server, the use of TAR/ZIP packages (specifically elastic-agent-9.3.3-linux-x86_64.tar.gz) is strongly recommended over RPM or DEB system packages. This recommendation is based on the technical requirement for Fleet-based upgrades. Only TAR/ZIP installations support the ability to be upgraded directly through the Fleet management console, providing a more streamlined administrative experience and reducing manual intervention during version transitions.

Fleet Server Deployment and Management

The Fleet Server acts as the control plane for the Elastic Agent instances. It is responsible for updating agent policies and collecting status information from all enrolled agents.

Prerequisites and Connectivity

Before initiating the Fleet Server setup, several technical requirements must be met to ensure a secure-by-default environment.

  • Administrative Privileges: If the built-in elastic superuser is not being utilized, the Kibana user must be granted All privileges for both Fleet and Integrations.
  • Network Connectivity: Elastic Agent hosts must have direct network paths to both the Fleet Server and the Elasticsearch cluster.
  • External Access: The Kibana host must be able to connect to https://epr.elastic.co on port 443. This is a critical requirement for the download of integration packages from the Elastic registry.

Execution Steps for Fleet Server Installation

The installation of the Fleet Server is performed through a combination of terminal commands and the Kibana administrative interface.

  1. Log into the designated Fleet Server host.
  2. Create a dedicated working directory to isolate installation files:
    mkdir fleet-install-files
  3. Navigate into the directory:
    cd fleet-install-files
  4. Identify the host IP address using the ifconfig command. This IP is required for the subsequent configuration steps in the Kibana UI.
  5. Open the Kibana web interface, navigate to Management -> Fleet, and select Add Fleet Server.

The Quick Start installation flow used in this process automatically generates a self-signed certificate for the Fleet Server. While this ensures a secure connection, it requires specific flags during the agent enrollment process to bypass standard certificate authority validation.

Elastic Agent Enrollment and Configuration

The Elastic Agent is a unified way to ship data from a host to the Elastic Stack. In this configuration, the agent is deployed with the System integration, allowing it to gather local system logs and metrics.

Installation Process

The installation is executed via the terminal on the Elastic Agent host. The process involves downloading the package, unpacking it, and running the installation binary.

  • Download the elastic-agent-9.3.3-linux-x86_64.tar.gz package from the Elastic Artifact Registry.
  • Unpack the archive.
  • Enter the directory containing the binaries.
  • Run the installation command.

Because the Fleet Server uses a self-signed certificate, the --insecure flag must be appended to the enrollment command. This tells the agent to trust the Fleet Server endpoint despite the lack of a signed certificate from a recognized CA. An example of the full command is:

sudo ./elastic-agent install --url=https://203.0.113.41:8220 --enrollment-token=VWCobFhKd0JuUnppVYQxX0VKV5E6UmU3BGk0ck9RM2HzbWEmcS4Bc1YUUM== --insecure

When prompted, the user must enter Y to install the Elastic Agent and configure it to run as a background service. Once the installation is complete and the Kibana Add agent flyout confirms the connection, the agent is successfully enrolled and managed by Fleet.

Data Ingestion Pipelines: Filebeat and Logstash

While the Elastic Agent provides a unified approach, many environments utilize Filebeat as a lightweight shipper, often routing data through Logstash for advanced processing.

Configuring Filebeat for Logstash Integration

To transition from a direct-to-Elasticsearch flow to a Logstash-mediated flow, the Filebeat configuration must be modified. This involves disabling the Elasticsearch output and enabling the Logstash output.

The setup process involves:
- Installing Filebeat on the target host.
- Modifying the configuration file to point to the Logstash instance.
- Enabling the system module to collect essential system logs.
- Loading the required ingest pipeline and index template into Elasticsearch to ensure data is indexed correctly.
- Starting and enabling the Filebeat service.

To verify that data is flowing correctly from Filebeat through Logstash and into Elasticsearch, the following curl command can be used to query the Elasticsearch API:

curl -XGET ‘http://localhost:9200/filebeat-*/_search?pretty’

Advanced Use Cases and Operational Value

The Elastic Stack provides immense value across various technical domains, moving beyond simple log aggregation into comprehensive observability and security.

Application Performance Monitoring (APM)

The stack can be used to monitor application performance in real-time. By collecting detailed performance data from applications and storing it in Elasticsearch, developers can use Kibana to identify bottlenecks and troubleshoot latency issues. This allows for a granular view of how a request moves through a microservices architecture, improving the overall user experience by reducing response times.

Security and Compliance

For security teams, the ELK stack is an invaluable tool for threat detection and regulatory compliance. Logstash can be used to collect logs from various systems and enrich them with external metadata, such as geolocation data or threat intelligence feeds. This enrichment allows security analysts to identify anomalies or known malicious IP addresses in real-time, providing a proactive defense mechanism.

Cloud-Based Data Observability

The stack is highly effective for collecting, processing, and visualizing cloud-based data. Logstash can ingest data from various cloud service providers, transforming it into a structured format for storage in Elasticsearch. Kibana then allows for the visualization of this data, enabling teams to detect trends and troubleshoot infrastructure issues across hybrid-cloud environments.

Conclusion: Analytical Overview of Self-Managed Infrastructure

The transition to a self-managed Elastic Stack 9.3.3 offers organizations total control over their data sovereignty and infrastructure tuning. However, this control comes with significant operational overhead. The requirement for a three-node cluster to ensure high availability necessitates a deep understanding of distributed systems and network configuration. The shift toward the Elastic Agent and Fleet Server model simplifies the management of remote hosts, replacing manual configuration files with centralized policy management.

The technical trade-off of utilizing self-signed certificates during the Quick Start process is a reduction in initial setup time at the cost of needing the --insecure flag during enrollment. For production environments, migrating to custom SSL/TLS certificates is essential to maintain a rigorous security posture. Furthermore, the integration of Logstash remains critical for complex data transformation needs that go beyond the capabilities of simple agents. While SaaS alternatives like Coralogix aim to reduce the hidden infrastructure costs and engineering resources required to maintain an ELK stack, the self-managed approach remains the gold standard for organizations requiring absolute control over their telemetry pipelines and data residency.

Sources

  1. Tutorial 1: Install a self-managed Elastic Stack
  2. ELK Stack: Definition, Use Cases, and Tutorial

Related Posts