ELK Stack
一句话解释
ELK Stack 是 logging platform 组合 Elasticsearch (搜索), Logstash (集合), and Kibana (visualization).
用大白话说
The ELK Stack is one of the most popular logging solutions. It consists of three open-source tools:
Elasticsearch — a distributed search and analytics engine that stores logs and lets you search them quickly. Logstash — a data processing pipeline that collects logs from various sources, transforms them, and sends them to Elasticsearch. Kibana — a visualization tool that lets you search, filter, and create dashboards from your logs.
A common addition is Beats (lightweight log shippers), making it the "ELK Stack" or sometimes "ELKB". The flow is: Beats collect logs → Logstash processes them → Elasticsearch stores them → Kibana visualizes them.
示例
# Search for error logs in Kibana
# Query: level:error AND service:my-app
# Logstash config example
input { beats { port => 5044 } }
filter { json { source => "message" } }
output { elasticsearch { hosts => ["localhost:9200"] } }Logstash 接收 logs 从 Beats on port 5044, parses JSON, and 发送到 Elasticsearch for storage and 搜索.
工作原理
- Beats or Logstash collect logs from your servers/containers.
- Logstash filters and transforms the log data.
- Elasticsearch stores the logs and indexes them for fast search.
- Kibana provides a UI to search, filter, and visualize the logs.
常见混淆
容易混淆的对象: EFK Stack
关键区别: ELK uses Logstash for 集合; EFK replaces Logstash 使用 Fluentd or Fluent 位, 哪个是 更多 lightweight and Kubernetes-native.
相关术语
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。