The Elastic Ecosystem Integrations
8 min read
Course: Elasticsearch
Topic 14: The Elastic Ecosystem Integrations 🌐
Welcome to the grand finale of our Elasticsearch journey! Up until now, we have treated Elasticsearch as a standalone genius—a brilliant brain that can search through millions of documents in milliseconds. But how does the data actually get into the brain? And how do we show off that data to our boss without making them read raw JSON files?
Imagine you are running a massive, multi-city pizza delivery empire (your infrastructure). You have millions of orders, delivery times, and customer complaints coming in constantly. If you try to manually read every single paper receipt (raw server logs) to find out why deliveries are late in New York, you are going to have a bad time. You need a system that automatically collects these receipts from every store, cleans them up, stores them neatly, and shows you a beautiful live chart of your operations.
Enter the ELK Stack (or Elastic Stack).
- Beats are the delivery drivers constantly shipping raw receipts from the edge stores to headquarters.
- Logstash is the sorting facility that takes dirty, crumpled receipts, translates them, and categorizes them.
- Elasticsearch is the giant, super-fast filing cabinet where all receipts are stored.
- Kibana is the manager's shiny dashboard showing pizza sales in real-time.
Let's break down each component progressively, from the ground up! 🚀
1. Logstash: Processing and Transforming Incoming Data 🧰
The Problem:
Servers, databases, and applications generate logs continuously. However, these logs are messy. An Apache web server logs in plain text, a custom Python app logs in JSON, and a firewall logs in a proprietary format. Elasticsearch thrives on structured data (JSON). If you throw raw, unstructured text into Elasticsearch, you cannot effectively query, filter, or aggregate it.
The Solution (Definition):
Logstash is a free and open server-side data processing pipeline. It dynamically ingests data from a multitude of sources, transforms it, and sends it to your preferred storage (usually Elasticsearch).
Under the Hood: The Logstash Pipeline
Logstash operates on a very strict, three-stage assembly line:
- Inputs: How data gets into Logstash (e.g., reading a file, listening on a port, pulling from Kafka).
- Filters: How data is modified. This is where the magic happens. You can parse text, remove sensitive fields (like passwords), or look up IP addresses to find geographic locations.
- Outputs: Where data goes next (e.g., Elasticsearch, a file, or an email alert).
Industry Standard: The Grok Filter
In the industry, 90% of what you will do in Logstash revolves around Grok. Grok is a filter plugin that parses unstructured log data into something structured. Think of it as "Regular Expressions (Regex) on steroids," but much easier to read.
If your web server spits out this raw string:55.3.244.1 GET /index.html 15824 0.043
Grok uses predefined patterns to map that text to fields:%{IP:client_ip} %{WORD:method} %{URIPATHPARAM:request} %{NUMBER:bytes} %{NUMBER:duration}
Example: A Basic Logstash Configuration (logstash.conf)
Here is what a standard Logstash configuration looks like in a production environment.
# 1. INPUT: Listen for Beats on port 5044
input {
beats {
port => 5044
}
}
# 2. FILTER: Transform the data
filter {
# Parse standard Apache/Nginx logs
grok {
match => { "message" => "%{COMBINEDAPACHELOG}" }
}
# Convert timestamps so Elasticsearch knows when the event actually happened
date {
match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ]
}
# Add geographical data based on the IP address!
geoip {
source => "clientip"
}
}
# 3. OUTPUT: Send to Elasticsearch 8.x
output {
elasticsearch {
hosts => ["https://localhost:9200"]
user => "elastic"
password => "YourSuperSecretPassword"
cacert => "/etc/logstash/certs/http_ca.crt" # Elastic 8 enforces secure connections!
index => "web-logs-%{+YYYY.MM.dd}"
}
}Notice how Elastic 8.x requires HTTPS and certificates by default. Gone are the days of accidentally exposing unencrypted data!
2. Beats: Deploying Lightweight Data Shippers 🪶
The Problem:
If Logstash is so great, why don't we just install Logstash on every single web server we own to read the log files?
Because Logstash runs on the Java Virtual Machine (JVM). It is heavy and consumes a significant amount of RAM and CPU. If you install a heavy Java application on a tiny edge server just to read a text file, your server will run out of memory and crash.
The Solution (Definition):
Beats are a collection of lightweight, single-purpose data shippers written in Go. You install them as agents on your edge servers to collect data and securely ship it to Logstash or directly to Elasticsearch. Because they are written in Go, they consume almost zero system resources.
The Beats Family (The Industry Heavyweights)
While there are many Beats, you will almost exclusively see these two in the wild:
- Filebeat: Tails (reads continuously) log files. If the server goes down, Filebeat remembers exactly which line it read last so no logs are lost.
- Metricbeat: Collects system-level metrics like CPU usage, memory, disk space, and network data.
Example: Filebeat Configuration (filebeat.yml)
Setting up Filebeat is incredibly simple. You tell it what file to look at, and where to send the data.
filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/nginx/access.log # The file we are stalking
# Ship the data to our Logstash server
output.logstash:
hosts: ["10.0.0.5:5044"]3. Kibana: Visualizing Your Elasticsearch Data 📊
The Problem:
Elasticsearch returns its search results in raw JSON. While developers might enjoy reading nested JSON brackets for fun, Business Analysts, Security Teams, and CEOs absolutely do not. You need a way to build charts, monitor cluster health, and search logs intuitively.
The Solution (Definition):
Kibana is a free and open frontend user interface that sits on top of Elasticsearch. It provides visual exploration, real-time dashboards, and administrative management capabilities for your Elastic Stack.
Key Kibana Concepts
To avoid wandering aimlessly in Kibana's vast menus, you only need to master three core concepts:
- Data Views (Formerly Index Patterns): Kibana doesn't know what data you want to look at. A Data View tells Kibana which Elasticsearch indices to fetch. For example, a Data View named
web-logs-*will group all your daily log indices together so you can search them as one giant database. - Discover: The raw data explorer tab. Here, you can type simple search queries (like
response_code: 404 AND geoip.country_name: "Nepal") and see the matching logs in a tabular format. - Dashboards: A collection of visualizations (Pie charts, Bar graphs, Heatmaps, Maps). You can build a map that literally shows dots around the globe representing where your website traffic is coming from.
Setting up Kibana in Elastic 8.x
In modern Elastic setups, security is built-in. When you start Elasticsearch, it generates an Enrollment Token.
When you start Kibana for the first time and visit http://localhost:5601, it will prompt you for this token to establish a secure, encrypted connection with Elasticsearch automatically. No more messing with manual SSL configurations!
4. Building a Complete Data Pipeline: End-to-End Example 🏗️
Let’s tie everything together by building an industry-standard logging pipeline.
The Scenario: You have a web application running on Nginx. You want to track how many users are hitting 404 Not Found errors and visualize it on a pie chart.
Step 1: The Edge Server (Filebeat)
You install Filebeat on your Nginx server. Filebeat is configured to read the Nginx access logs and forward them to your central Logstash server.
Under the hood: Filebeat opens /var/log/nginx/access.log, reads the new lines added by Nginx, batches them up, and shoots them over the network to port 5044.
Step 2: The Processor (Logstash)
Your central Logstash server receives the raw text payload:192.168.1.50 - - [25/Feb/2026:05:00:01 +0000] "GET /hidden-page HTTP/1.1" 404 153
Logstash pushes this through the grok filter (using the %COMBINEDAPACHELOG} pattern) and the geoip filter. The output becomes a beautifully structured JSON document:
{
"clientip": "192.168.1.50",
"timestamp": "2026-02-25T05:00:01Z",
"request": "/hidden-page",
"response": "404",
"geoip": {
"location": { "lat": 27.7172, "lon": 85.3240 },
"country": "Nepal"
}
}Logstash then sends this JSON document securely to the Elasticsearch cluster.
Step 3: The Brain (Elasticsearch)
Elasticsearch receives the JSON document, indexes it under the name web-logs-2026.02.25, and makes it searchable within 1 second. It automatically maps "response": "404" as a keyword and the geoip.location as a geo-point.
Step 4: The Show-Off (Kibana)
You log into Kibana.
- You go to Stack Management > Data Views and create
web-logs-*. - You navigate to Dashboard and click Create Visualization.
- You select a Donut Chart.
- You set the metric to "Count of Records" and split the slices by the field
response. - Instantly, a chart appears showing that 15% of your traffic is hitting
404errors, and another map visualization shows that most of these errors are originating from Nepal!
Congratulations! You have successfully built a complete, highly scalable Elastic pipeline that is heavily used in cybersecurity (SIEM), observability, and data analytics worldwide. 🎉
References & Extra Reading 📚
Challenge
Logstash Configuration Challenge
Your task is to create a complete Logstash configuration file to process Nginx access logs. The pipeline must perform the following actions in order:
- Input: Configure the pipeline to receive events from Beats clients on port
5044. - Filter - Parse: Use the
grokfilter to parse the incoming log lines, which are in the standardCOMBINEDAPACHELOGformat and are contained in themessagefield. - Filter - Enrich: Use the
geoipfilter to add geographical location data based on theclientipfield extracted by the grok filter. - Filter - Mutate: After enrichment, use the
mutatefilter to remove theauthfield from the event to prevent sensitive information from being stored. - Output: Send the processed events to a secure Elasticsearch cluster. The configuration should point to a single host
https://es-node-1:9200, authenticate with the usernamelogstash_writer, and use a password from the environment variableLS_PASSWORD. The connection must be secured using a CA certificate located at/etc/pki/tls/certs/ca.crt.
Expected result
Your solution should be a single Logstash configuration file containing input, filter, and output sections.
- The
inputblock must contain abeatsplugin listening onport => 5044. - The
filterblock must contain three filters in the correct order:- A
grokfilter with amatchdirective for themessagefield using theCOMBINEDAPACHELOGpattern. - A
geoipfilter with itssourceset to theclientipfield. - A
mutatefilter with aremove_fieldaction targeting theauthfield.
- A
- The
outputblock must contain anelasticsearchplugin with the following options correctly configured:hosts: pointing to["https://es-node-1:9200"]user: set to"logstash_writer"password: set to${LS_PASSWORD}to reference the environment variable.cacert: pointing to"/etc/pki/tls/certs/ca.crt"