Orchestrating the ELK Logging Stack via DigitalOcean Blueprints and 1-Click Deployments

The deployment of a centralized logging and analytics framework is a cornerstone of modern observability, allowing engineers to aggregate, analyze, and visualize massive volumes of log data in real-time. Within the DigitalOcean ecosystem, this is achieved through the ELK stack, which comprises Elasticsearch, Logstash, and Kibana. DigitalOcean provides multiple pathways to instantiate this stack, ranging from the simplified 1-Click App for individual components to the more robust Blueprint architecture. A Blueprint represents a shift from simple image deployment to infrastructure-as-code (IaC), utilizing Terraform to provision a multi-node environment where each component of the stack is isolated on its own virtualized resource, known as a Droplet. This architectural separation ensures that the resource-intensive nature of Elasticsearch—specifically its memory consumption—does not starve the ingestion capabilities of Logstash or the visualization needs of Kibana. By automating the provisioning of these three distinct droplets, DigitalOcean allows users to bypass the manual installation of Java runtimes, the configuration of systemd services, and the complex network orchestration required to link the nodes into a cohesive logging pipeline.

DigitalOcean Blueprints vs. 1-Click Applications

The distinction between a Blueprint and a 1-Click App is fundamental to how infrastructure is managed and scaled. A 1-Click App is designed for rapid, single-instance deployment. For example, the Elasticsearch 1-Click App allows a user to create a fully configured instance of the search engine in approximately one minute. This is ideal for developers who need a standalone database for testing or a small-scale project. However, for a full logging pipeline, the Blueprint approach is superior. DigitalOcean Blueprints are Terraform-based deployments that enable the simultaneous spinning up of multiple resources. Rather than deploying one server and manually installing the other two components of the ELK stack, the Blueprint automates the creation of three separate Droplets.

This approach provides a production-ready starting point by ensuring that the infrastructure configuration, cost, and software deployments are handled as a single unit of work. This removes the "complicated deployment configurations" typically associated with manual ELK setups, such as configuring the elasticsearch.yml file to point to specific internal IP addresses or managing the firewall rules across three different machines. The impact for the user is a drastic reduction in time-to-value; the transition from an empty account to a functioning dashboard is reduced to a few clicks or a few Terraform commands.

The Architectural Components of the ELK Stack

The ELK Blueprint deploys three specific components, each residing on its own Droplet to ensure operational stability and resource isolation.

Elasticsearch

Elasticsearch serves as the heart of the stack, acting as the distributed search and analytics engine. It stores the indexed data and provides the API for querying that data. In the DigitalOcean deployment, Elasticsearch is configured in a single-node discovery mode. This means it operates as a standalone cluster, which is appropriate for small to medium workloads but avoids the complexity of managing a multi-node cluster during the initial setup phase.

Logstash

Logstash is the data processing pipeline. It ingests data from various sources, transforms it (using filters), and then sends it to a "sink," which in this case is Elasticsearch. By placing Logstash on its own Droplet, the system can handle high-volume log ingestion without impacting the performance of the Elasticsearch indexing engine or the Kibana user interface.

Kibana

Kibana is the visualization layer. It provides a graphical user interface (GUI) that allows users to explore the data stored in Elasticsearch. It transforms complex JSON queries into intuitive charts, graphs, and maps. The Blueprint ensures Kibana is pre-configured to communicate with the Elasticsearch Droplet, providing a direct window into the logs.

Technical Specifications and Licensing

The ELK stack on DigitalOcean utilizes the latest available versions of the software, ensuring that users have access to the most recent security patches and feature sets. The licensing for these components is varied and critical for corporate compliance.

Component Version License
ElasticSearch Latest ELv2
Kibana Latest Dual license: Server Side Public License and Elastic License 2.0
LogStash Latest Apache License V2 and Elastic License

The use of the ELv2 and Server Side Public License indicates that while the software is provided for use, it is not "open source" in the traditional OSI sense. Users must be aware that the DigitalOcean stack does not provide a commercial Elastic license. If a business requires the specific legal protections or features associated with a paid Elastic license, it is the responsibility of the user to acquire one independently.

Deployment Methodologies

There are three primary ways to deploy the ELK environment on DigitalOcean: through the Control Panel, the API, or via Terraform-based Blueprints.

Control Panel Deployment

For users preferring a GUI, the process involves navigating to the "Create Droplet" menu. Under the "Applications" tab, users can select the "ELK Logging Stack" button.

  • User selects the region closest to their client base to minimize latency.
  • User chooses the droplet size. While a $5/month droplet can function for minimal tests, the recommended specification is the $20/month plan providing 2 CPUs and 2GB of RAM.
  • Authentication is handled via SSH keys or a root password emailed by the system.
  • The deployment process takes approximately one minute for a single droplet, but the full configuration of the stack may take longer.

API-Driven Deployment

For automation and DevOps integration, DigitalOcean allows the creation of instances via the API. An example for creating a 4GB Elasticsearch Droplet in the SFO2 region can be executed using a curl command, allowing the infrastructure to be scripted into larger deployment pipelines.

Terraform and Blueprint Execution

For advanced users, the Blueprint can be deployed using Terraform, providing full transparency into the infrastructure code.

  1. Install Terraform on the local machine.
  2. Validate the installation:
    terraform -v
  3. Generate a Personal Access Token (PAT) from the DigitalOcean "Applications & API" page. The "Write" scope must be enabled, as Terraform requires permission to create and modify resources.
  4. Clone the official blueprints repository:
    git clone https://github.com/digitalocean/marketplace-blueprints.git
  5. Navigate to the ELK specific directory:
    cd marketplace-blueprints/blueprints/elk/
  6. Configure the variables.tf file with the API token:
    variable "do_token" { default = "dop_v1_your_beautiful_token_here" }
  7. Initialize the project:
    terraform init
  8. Deploy the infrastructure:
    terraform apply

Post-Deployment Configuration and Access

Once the Terraform apply command finishes or the Control Panel indicates the Droplets are ready, a waiting period of 5 to 6 minutes is required. This allows the user_data scripts to finish installing the APT packages and configuring the systemctl services.

Accessing the Dashboard

Kibana is accessible via the web browser using the IP address of the Kibana Droplet on port 5601:
http://<kibana-droplet-ip>:5601

If the user encounters a message stating "Kibana server is not ready yet" or is prompted for an enrollment token, it indicates that the background configuration scripts are still running. Further waiting is required.

Retrieving Credentials

The ELK stack is deployed with XPACK basic security enabled. This means the instances are password-protected by default. To retrieve the administrative credentials:
1. SSH into the Elasticsearch Droplet as the root user.
2. The passwords for the elastic user, as well as the Kibana and Logstash passwords, are printed in the terminal or stored in the system logs.

Monitoring the Installation

If the stack does not appear to be functioning, users can inspect the configuration logs. Both Elasticsearch and Kibana configuration logs are stored in the same location:
/var/log/user_data.log

Performance Tuning and Optimization

Running the ELK stack, particularly Elasticsearch, requires careful memory management to prevent the Linux kernel from killing the process due to Out-Of-Memory (OOM) errors.

Managing the Java Virtual Machine (JVM)

Both Elasticsearch and Logstash run on the JVM. The runtime environment can be tweaked via the configuration files to optimize performance. For Elasticsearch, the heap size must be explicitly set to prevent the application from consuming all available system memory, and memory swapping must be disabled to maintain disk I/O performance.

The configuration is managed via the following file:
vi /etc/default/elasticsearch

The following lines must be uncommented and set correctly:
ES_HEAP_SIZE=750m
MAX_LOCKED_MEMORY=unlimited

The general rule for Elasticsearch heap sizing is that it should be approximately half of the total physical RAM of the server, but it must never exceed 32GB. On a 2GB RAM droplet, a heap size of 750m to 1g is optimal.

Cleaning the Environment

When taking over a fresh installation or changing the cluster name, it is recommended to stop the services and clear existing logs to avoid configuration confusion. This is achieved by executing the following commands:

  • Stop the services:
    service elasticsearch stop
    service logstash stop
    service logstash-web stop
    service logstash-forwarder stop

  • Clear the log directories:
    rm /var/log/elasticsearch/*
    rm /var/log/logstash/*

Conclusion

The deployment of the ELK stack on DigitalOcean represents a sophisticated balance between automation and flexibility. By utilizing Blueprints, the platform transforms a complex, multi-node software installation into a repeatable, version-controlled infrastructure event. The shift from a single-droplet "all-in-one" install to a three-droplet distributed architecture ensures that the high CPU and RAM demands of Elasticsearch do not interfere with the data ingestion of Logstash or the visualization capabilities of Kibana.

The integration of Terraform allows for an "Infrastructure as Code" workflow, providing a level of transparency and reproducibility that is essential for production environments. While the 1-Click App provides the fastest path to a running instance, the Blueprint's adherence to a distributed model is the only viable path for those scaling their logging operations. The critical success factor for this deployment lies in the post-installation phase: the proper adjustment of the JVM heap size and the verification of the user_data.log to ensure that all systemctl services have transitioned to an active state. Ultimately, this ecosystem provides a powerful, scalable window into application telemetry, provided the user manages the licensing requirements and resource allocations with precision.

Sources

  1. ELK Blueprint Catalog
  2. ElasticSearch 1-Click App
  3. Using the ELK Logging Stack Application on Digital Ocean
  4. DigitalOcean Marketplace Blueprints GitHub

Related Posts