Operations 11 min read

Master Real-Time Log Management with the Open-Source ELK Stack

This guide walks you through centralized log collection, explains the roles of Elasticsearch, Logstash, and Kibana, and provides step‑by‑step commands to install, configure, and verify a complete ELK logging pipeline for Linux servers.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master Real-Time Log Management with the Open-Source ELK Stack

Logs include system, application, and security logs. Centralized logging helps ops and developers monitor server health, detect errors, and assess performance.

Traditional per‑server log access is cumbersome; using a centralized solution like syslog aggregates logs.

For advanced search and analysis, the ELK stack (Elasticsearch, Logstash, Kibana) provides a complete pipeline.

ELK Component Overview

Elasticsearch is a distributed search engine with features such as zero‑configuration, automatic node discovery, sharding, replication, RESTful API, and multi‑source support.

Logstash collects, parses, and stores logs for later use.

Kibana offers a web UI for visualizing and searching logs processed by Logstash and stored in Elasticsearch.

Installation Procedure

1. Install JDK (Java Runtime) required by Logstash. Download the appropriate JRE, extract it, and set JAVA_HOME and PATH environment variables.

# wget http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz
# mkdir /usr/local/java
# tar -zxf jdk-8u45-linux-x64.tar.gz -C /usr/local/java/
# export JAVA_HOME=/usr/local/java/jdk1.8.0_45
# export PATH=$PATH:$JAVA_HOME/bin

2. Install Logstash by downloading and extracting the tarball.

# wget https://download.elastic.co/logstash/logstash/logstash-1.5.2.tar.gz
# tar -zxf logstash-1.5.2.tar.gz -C /usr/local/
# /usr/local/logstash-1.5.2/bin/logstash -e 'input { stdin { } } output { stdout {} }'

3. Install Elasticsearch, extract it, and start the service.

# tar -zxf elasticsearch-1.6.0.tar.gz -C /usr/local/
# /usr/local/elasticsearch-1.6.0/bin/elasticsearch
# nohup /usr/local/elasticsearch-1.6.0/bin/elasticsearch >nohup &
# netstat -anp | grep :9200

4. Verify Logstash can send data to Elasticsearch using a simple configuration file and curl queries.

# cat logstash-es-simple.conf
input { stdin { } }
output {
  elasticsearch { host => "localhost" }
  stdout { codec => rubydebug }
}
# /usr/local/logstash-1.5.2/bin/logstash -f logstash-es-simple.conf
# curl 'http://localhost:9200/_search?pretty'

5. Install the Kopf plugin for Elasticsearch to browse data.

# cd /usr/local/elasticsearch-1.6.0/
# ./plugin -install lmenezes/elasticsearch-kopf

6. Install Kibana, extract it, and launch the web UI (default port 5601). Configure an index pattern (e.g., logstash-*) to view incoming logs.

# tar -zxf kibana-4.1.1-linux-x64.tar.gz -C /usr/local/
# /usr/local/kibana-4.1.1-linux-x64/bin/kibana

7. Optionally configure Logstash as an indexer to ingest system logs into Elasticsearch.

# cat /usr/local/logstash-1.5.2/logstash-indexer.conf
input {
  file { type => "syslog" path => ["/var/log/messages","/var/log/syslog"] }
  syslog { type => "syslog" port => "5544" }
}
output {
  stdout { codec => rubydebug }
  elasticsearch { host => "localhost" }
}
# /usr/local/logstash-1.5.2/bin/logstash -f logstash-indexer.conf

After completing these steps, the ELK platform is ready for real‑time log collection, search, and visualization.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

ElasticsearchDevOpsLinuxELKLog ManagementLogstashKibana
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.