什麼是 ELK?

ELK 介紹

ELK 介紹
- 什麼是 ELK?
- ELK 用在哪裡 ?
- Elasticsearch Cluster 介紹
- Kibana 演示
ELK 安裝與設定
- 手動安裝
- logstash 設定 (grok)
- docker 版安裝與使用方法
- ES Cluster 安裝
ELK 使用案例
- 系統效能監控
- 應用程式除錯監控
- 網路資安監控
- 客服也能用
ELK 程式設計
- Dev Tools
- curl
- python
- Timelion
課程總覽
#DevOps = ~CA(L)MS
C(ulture) - 文化
A(utomation) - 自動化
L(ean) - 敏捷
M(etric) - 監控
S(haring) - 分享

M(onitoring & Measuring)
- 監控與量測
- Metric - CPU, Memory, Disk, Networking
- Logs - Application Logs, System Logs...
- SNMP - devices, switches...
- Security - authd.log, auth.log, fail2ban.log
- IoT - any data format with timestamps
傳統的 monitoring 工具

傳統的 website 架構

傳統的 website 軟體

現在的 website 架構

現在的 website 軟體

未來的 docker 世界

ELK = E(lasticsearch)
+ L(ogstash)
+ K(ibana)

<- this is an
elk as well
2012 年開始 Elasticsearch
漸漸被廣泛使用

3 年前開始 Elasticsearch
變成首選

7 年後的今天 Elasticsearch
遙遙領先

ELK 用在哪裡 ?
初期
- 開發者除錯
- 全文檢索
- 大數據資料收集
現在
- 資安監控
- AI 資料來源與分析
- logs 資料整合
- IoT 資料視覺化
- APM 系統效能監測
未來
- ???
- 功能太強, 用途太廣, 實在無法預期還能怎麼用
以開發者除錯為例
開發團隊這樣用 ELK

docker 版 ELK 這樣用

用 docker
大量部署
ELK 最簡單的安裝架構

... 多台
ELK 最簡單的安裝架構

... 多台
以 IIS Web Server 為例



ELK log 的資料流

Redis 當 buffer

logstash
redis
Logstash config

logstash config 檔的位置

/opt/logstash/bin/logstash -f turboteam-iislog-cell.conf
/opt/logstash/bin/logstash -f turboteam-iislog-cell.conf --configtest
Configuration OK
Logstash config 範例

Elasticsearch Cluster 架構

-
indexing
-
全文檢索
-
查詢主機
-
分散式資料庫
-
cluster 架構
-
自動 shards
-
自動 replicas
- REST API
4 nodes 的實體架構

資料複製與 sharding

elasitcsearch 設定檔
修改 /etc/elasticsearch/elasticsearch.yml
sudo service elasticsearch restart

Elasticsearch Plugins
- HQ, head, BigDesk, SQL ...
安裝 plugin 指令:
cd /usr/share/elasticsearch
sudo bin/plugin install royrusso/elasticsearch-HQ
sudo bin/plugin install mobz/elasticsearch-head
sudo bin/plugin install lukas-vlcek/bigdesk
http://10.1.100.121:9200/_plugin/hq

http://10.1.100.121:9200/_plugin/head/

Kibana 做資料視覺化的 GUI

-
Web GUI
-
資料視覺化
-
auto refresh
-
容易查詢
-
容易編輯
-
Dashboard
-
輸出入 JSON
- Plugins
Dashboard

自己做自己喜歡的畫面
Q & A


什麼是 ELK? ELK 介紹
ELK 介紹
By Ming-der Wang
ELK 介紹
- 1,246