[ELK Stack] Ubuntu 22.04.3 ๋ชจ๋‹ˆํ„ฐ๋ง ์‹œ์Šคํ…œ ๊ตฌ์ถ• feat.Docker & beat

2023. 10. 3. 03:13ใ†System ์ž‘์—…์‹ค/DevOps

728x90
๋ฐ˜์‘ํ˜•

 



 

 

 

Applied Elk Stack: Data Insights and Business Metrics with Collective Capability of Elasticsearch Log...

COUPANG

www.coupang.com

"์ด ํฌ์ŠคํŒ…์€ ์ฟ ํŒก ํŒŒํŠธ๋„ˆ์Šค ํ™œ๋™์˜ ์ผํ™˜์œผ๋กœ, ์ด์— ๋”ฐ๋ฅธ ์ผ์ •์•ก์˜ ์ˆ˜์ˆ˜๋ฃŒ๋ฅผ ์ œ๊ณต๋ฐ›์Šต๋‹ˆ๋‹ค."

 

 

 

๐Ÿš€ Elastic Stack ๊ตฌ์ถ•

    ๐Ÿ”ฝ ๊ฐœ์š”

        ๐Ÿ“ฆ ์†Œ๊ฐœ

์ด๋ฒˆ์—๋Š” Linux Server๋“ค์— ๋Œ€ํ•œ ์ž์› ๋ชจ๋‹ˆํ„ฐ๋ง์„ ์‹ค์‹œํ•˜๊ณ , ๋”๋ถˆ์–ด ๋กœ๊ทธ ๋ถ„์„๋„ ํ•  ์ˆ˜ ์žˆ๋Š” Elastic Stack(ELK)๋ฅผ ๊ตฌ์ถ•ํ•ด ๋ณด๋ ค๊ณ  ํ•ด์š”. 

ELK๋Š” Elasticsearch, Logstash, Kibana๋ผ๋Š” ์˜คํ”ˆ ์†Œ์Šค ํ”„๋กœ์ ํŠธ๋“ค์„ ํ•˜๋‚˜๋กœ ๋ญ‰์ณ ์•ž๊ธ€์ž๋งŒ ๋”ด ๊ฒƒ์ด์—์š”.

Elasticsearch๋Š” ๊ฒ€์ƒ‰ ๋ถ„์„ ์—”์ง„์ด๊ณ , Logstash๋Š” ์—ฌ๋Ÿฌ ์†Œ์Šค์—์„œ ๋™์‹œ์— Data๋ฅผ ์ˆ˜์ง‘ํ•˜์—ฌ ๋ณ€ํ™˜ํ•œ ๋’ค Elasticsearch์™€ ๊ฐ™์€ stash๋กœ ์ „์†กํ•˜๋Š” Server Side Data Pipeline์ด์—์š”. Kibana๋Š” ์‚ฌ์šฉ์ž๊ฐ€ Elasticsearch์—์„œ Chart์™€ Grahp๋ฅผ ์ด์šฉํ•˜์—ฌ Data๋ฅผ ์‹œ๊ฐํ™”ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด ์ฃผ๋Š” ๋„๊ตฌ์—์š”.

Elastic Stack์€ Elatic Stack์ด ๋ฐœ์ „ํ•œ ๋„๊ตฌ์—์š”.

์ตœ์ดˆ ์ด ํ”„๋กœ์ ํŠธ๋Š” Elasticsearch์—์„œ ์˜ํ–ฅ์„ ๋ฐ›์•˜๋‹ค๊ณ  ํ•ด์š”.
JSON ๊ธฐ๋ฐ˜์˜ ๋ถ„์‚ฐ ์˜คํ”ˆ ์†Œ์Šค RESTFul ๊ฒ€์ƒ‰์—”์ง„์œผ๋กœ ์‚ฌ์šฉํ•˜๊ธฐ ์‰ฝ๊ณ , ํ™•์žฅ ๊ฐ€๋Šฅํ•˜๊ณ , ์œ ์—ฐํ•˜๋ฉฐ, ๊ฒ€์ƒ‰ ๋ถ„์•ผ์—์„œ๋Š” ์‚ฌ์šฉ์ž์—๊ฒŒ ๋งŽ์€ ์ธ๊ธฐ๊ฐ€ ์žˆ๋Š” ๋„๊ตฌ์ด์ฃ .

์—ฌ๊ธฐ์— ๋”๋ถˆ์–ด Logstash์™€ Kibana๋ฅผ ๋ญ‰์ณ ํ•˜๋‚˜์˜ ์„œ๋น„์Šค๊ฐ€ ๋˜์—ˆ๋Š”๋ฐ, ์‚ฌ์šฉ์ž ๋กœ๊ทธ๋ฅผ ์œ„ํ•ด Elasticsearch๋ฅผ ์‚ฌ์šฉํ•˜๊ณ , ์ด๊ฒƒ์„ ์‹œ๊ฐํ™” ํ•˜๊ณ  ์‹ถ๋‹ค๋Š” ์š•๊ตฌ์—์„œ ์‹œ์ž‘ํ–ˆ์–ด์š”.

๊ทธ๋ž˜์„œ ๊ฐ•๋ ฅํ•œ ์ˆ˜์ง‘ ํŒŒ์ดํ”„๋ผ์ธ์ธ Logstash์™€ ์œ ์—ฐํ•œ ์‹œ๊ฐํ™” ๋„๊ตฌ Kibana๊ฐ€ ๋„์ž… ๋˜์—ˆ๋‹ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค.

๋˜ํ•œ, ELK์— Beat๋ผ๋Š” ๊ฒƒ์ด ์ถ”๊ฐ€ ๋˜์—ˆ๋Š”๋ฐ, ์ด๋Š” ์‚ฌ์šฉ์ž๋“ค์ด File์„ ์ถ”์ ํ•˜๊ณ  ์‹ถ๋‹ค๋Š” ์š”๊ตฌ๋ฅผ ํ–ˆ๊ณ , ์ด๋ฅผ ์ถฉ์กฑ ์‹œํ‚ค๊ธฐ ์œ„ํ•ด ELK Stack์— ๊ฒฝ๋Ÿ‰ ๋‹จ์ผ ๋ชฉ์  ๋ฐ์ดํ„ฐ ์ˆ˜์ง‘๊ธฐ ์ œํ’ˆ์ธ Beat๋ฅผ ํƒ„์ƒ ์‹œ์ผฐ๋‹ค๊ณ  ํ•ด์š”.

๊ฒฐ๊ตญ ELK๋Š” ์ด๋Ÿฌํ•œ ๋‚ด์šฉ์„ Log ๋ฐ Data ๋ถ„์„ ๋„๊ตฌ์—์š”.


1) ElasticSearch
  - ElasticSearch๋Š” Lucene ๊ธฐ๋ฐ˜์œผ๋กœ ๊ฐœ๋ฐœ๋œ ๊ฒ€์ƒ‰ ์—”์ง„์œผ๋กœ, Logstash๋ฅผ ํ†ตํ•ด ์ˆ˜์‹ ๋œ Data๋ฅผ ์ €์žฅ์†Œ์— ์ €์žฅํ•˜๋Š” ์—ญํ• .
  - Web Interface์™€ Schema๊ฐ€ ํ•„์š”์—†๋Š” JSON ๋ฌธ์„œ๋ฅผ ๊ฐ–์ถ˜ multitenant-capable full-text search ์—”์ง„ ์ œ๊ณต.
  - Data๋ฅผ ์ค‘์‹ฌ๋ถ€์— ์ €์žฅํ•˜์—ฌ ์˜ˆ์ƒ๋˜๋Š” ํ•ญ๋ชฉ์„ ๊ฒ€์ƒ‰ํ•˜๊ณ , ์˜ˆ์ƒ์น˜ ๋ชปํ•œ ํ•ญ๋ชฉ์„ ๋ฐํ˜€๋‚ด๋Š” ๊ธฐ๋Šฅ.
  - ์ •ํ˜•, ๋น„์ •ํ˜•, ์œ„์น˜์ •๋ณด, Metric ๋“ฑ ์›ํ•˜๋Š” ๋ฐฉ๋ฒ•์œผ๋กœ ๋‹ค์–‘ํ•œ ์œ ํ˜•์˜ ๊ฒ€์ƒ‰์„ ์ˆ˜ํ–‰ํ•˜๊ณ , ๊ฒฐํ•ฉ.
  - 9200 Port.

2) Logstash
  - ์˜คํ”ˆ์†Œ์Šค ์„œ๋ฒ„ ์ธก ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ ํŒŒ์ดํ”„๋ผ์ธ์œผ๋กœ ๋‹ค์–‘ํ•œ ์†Œ์Šค์—์„œ ๋™์‹œ์— ๋ฐ์ดํ„ฐ๋ฅผ ์ˆ˜์ง‘ํ•˜๊ณ ,
     ๋ณ€ํ™˜ํ•˜์—ฌ stash ๋ณด๊ด€์†Œ๋กœ ์ „๋‹ฌ.

  - ์ˆ˜์ง‘ํ•  Log ์„ ์ • ๋ฐ ์ง€์ • ๋Œ€์ƒ ElasticSearch์— Indexingํ•˜์—ฌ ์ „๋‹ฌํ•˜๋Š” ์—ญํ• .
  - Port 5044.

3) Kibana
  - Data ์‹œ๊ฐ์ ์œผ๋กœ ํƒ์ƒ‰, ์‹ค์‹œ๊ฐ„ ๋ถ„์„ ๊ธฐ๋Šฅ.
  - ์‹œ๊ฐํ™” ๋‹ด๋‹น HTML + Javascript ์—”์ง„.
  - Port 5601

4) Beat
  - Server์— Agent๋กœ ์„ค์น˜ํ•˜์—ฌ ๋‹ค์–‘ํ•œ ์œ ํ˜•์˜ Data๋ฅผ ElasticSearch ๋˜๋Š” Logstash์— ์ „์†กํ•˜๋Š” ์˜คํ”ˆ ์†Œ์Šค ๋ฐ์ดํ„ฐ
     ๋ฐœ์†ก์ž.


 

ELK Stack์€ ELK์— Beat๊ฐ€ ์ถ”๊ฐ€๋˜์–ด ELK Stack์ด๋ผ๊ณ  ๋ถ€๋ฅด๊ณ  ์žˆ์–ด์š”.

1) Filebeat
  - File ์ „๋‹ฌ ์—ญํ•  (์ผ๋ฐ˜์ ์œผ๋กœ Log, .json Type์˜ File).

2) Auditbeat
  - Logstash ๋˜๋Š” Elastic Search๋กœ Log๋ฅผ ๋ณด๋‚ด๊ธฐ ์ „์— Linux Audit Framwork Data๋ฅผ ์ˆ˜์ง‘ํ•˜๊ณ , File ๋ฌด๊ฒฐ์„ฑ Monitoring ์—ญํ• .

3) Metricbeat
  - Logstash, Elastic Search๋กœ ์ง์ ‘ ์ „์†ก๋˜๊ธฐ ์ „์— CPU, Memory ์‚ฌ์šฉ๋Ÿ‰, ๋ถ€ํ•˜ ๋“ฑ์˜ System๊ณผ Service์—์„œ Metric ์ˆ˜์ง‘ํ•˜๊ณ , Network Data์™€ Process Data๋กœ๋ถ€ํ„ฐ ๊ธฐํƒ€ Data ํ†ต๊ณ„ ์ˆ˜์ง‘.

4) Packetbeat
  - HTTP, DNS, Flows, DHCPv4, MySQL, TLS ๋“ฑ Application ๋ฐ ํ•˜์œ„ Leve Protocol, Data Base ๋ฐ Key Storage์˜ Network Protocol ์ปฌ๋ ‰์…˜ ์ง€์›. ์˜์‹ฌ์Šค๋Ÿฌ์šด Network ์ ‘๊ทผ ์‹๋ณ„ ๊ธฐ๋Šฅ

5) Heartbeat: Service ์ด์šฉ ๊ฐ€๋Šฅ ์—ฌ๋ถ€ ํŒ๋‹จํ•˜๊ธฐ ์œ„ํ•˜์—ฌ ์‚ฌ์šฉ.

6) Winlogbeat: Windows Event Log ๊ด€๋ฆฌ


์ตœ์‹  Major Release ELK Stack 8.0์—๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ธฐ๋Šฅ์ด ์ถ”๊ฐ€ ๋˜์—ˆ์–ด์š”.
  โˆ™ System Index ๋ณดํ˜ธ ๊ฐ•ํ™”
  โˆ™ ์ƒˆ๋กœ์šด K-Nearest Neighbor(KNN) API
  โˆ™ ๋ณด์•ˆ ๊ธฐ๋Šฅ ๊ธฐ๋ณธ ํ™œ์„ฑํ™”(HTTPS ๋ฐ ์ธ์ฆ)
  โˆ™ 7.x REST API ํ˜ธํ™˜

 

์„ค์น˜ํ•˜๊ธฐ ์ „์— ์ฃผ๋‹ˆ์“ฐ๊ฐ€ ์ค€๋น„ํ•œ ์ค€๋น„๋ฌผ์€ ์•„๋ž˜์™€ ๊ฐ™์•„์š”.

์ฃผ๋‹ˆ์“ฐ๋Š” Docker๋ฅผ ์ด์šฉํ•˜์—ฌ ๊ฐ๊ฐ ๋‘ ๊ฐœ์˜ VM ์šฐ๋ถ„ํˆฌ ์„œ๋ฒ„์— Elastic Search์™€ Kibana, Logstash๋ฅผ ์„ค์น˜ํ•ด ๋ณผ๊ฒŒ์š”.  

 

 

 

    ๐Ÿ”ฝ ELK Stack

        ๐Ÿ“ฆ ์ดˆ๊ธฐ ํ™˜๊ฒฝ ๊ตฌ์„ฑ - Elastic Search

์ตœ์ดˆ Docker(๋„์ปค) ๋ช…๋ น์–ด๋ฅผ ์ด์šฉํ•˜์—ฌ Elastic Search Container๋ฅผ ๊ธฐ๋™ ์‹œ์ผœ ์ค„๊ฑด๋ฐ, Shell Script(์‰˜ ์Šคํฌ๋ฆฝํŠธ)๋ฅผ ๋งŒ๋“ค์–ด ์ž‘์—…ํ•ด ๋ณผ๊ฒŒ์š”.

cat elasticDockerRun.sh

 

#!/bin/bash

/docker/dockerManagement/docker-compose/elasticSearch/dockerRunShell.sh

docker exec -it junyss-elasticSearch bin/elasticsearch-plugin install analysis-nori


์œ„ ์‰˜ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ๊ธฐ๋™ํ•ด ์ฃผ๋ฉด dockerRunShell ์ด๋ผ๋Š” ์‰˜ ์Šคํฌ๋ฆฝํŠธ๊ฐ€ ๊ธฐ๋™ ๋ ๊ฑฐ๊ณ , ๊ทธ๋Ÿฐ ๋’ค ๋„์ปค ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์ƒ์„ฑ๋˜๋ฉด
๊ทธ ์ปจํ…Œ์ด๋„ˆ ๋‚ด๋ถ€์— nori๋ฅผ ์„ค์น˜ํ•  ์ˆ˜ ์žˆ๋„๋ก ์Šคํฌ๋ฆฝํŠธ๋ฅผ ๋งŒ๋“ค์–ด ์ฃผ์—ˆ์–ด์š”.

cat dockerRunShell.sh

728x90
docker run -d \
--name junyss-elasticSearch \
--hostname junyss-elasticSearch \
-p 9200:9200 \
-p 9300:9300 \
-p 50000:50000 \
-e "discovery.type=single-node" \
-e "ES_JAVA_OPTS=-Xms1g -Xmx1g" \
-e bootstrap.memory_lock=true \
-e "xpack.security.enabled=true" \
-it -m 1GB \
--restart=unless-stopped \
docker.elastic.co/elasticsearch/elasticsearch:8.10.2


์œ„์™€ ๊ฐ™์ด Elastic Search 8.10.2 ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์„ค์น˜ํ•  ์ˆ˜ ์žˆ๋„๋ก ์Šคํฌ๋ฆฝํŠธ๋ฅผ ๋งŒ๋“ค์–ด ์ฃผ์—ˆ์–ด์š”.

ํ•ด๋‹น ์‰˜ ์Šคํฌ๋ฆฝํŠธ์— chmod +x ๋ช…๋ น์–ด๋ฅผ ์ด์šฉํ•˜์—ฌ ์‹คํ–‰ ๊ถŒํ•œ์„ ์ฃผ์–ด์•ผ ํ•ด์š”.

๊ทธ๋Ÿฐ ๋’ค elasticDockerRun.sh๋ฅผ ์‹คํ–‰ํ•˜๋ฉด Elastic Search๊ฐ€ ์„ค์น˜๋  ๊ฑฐ์—์š”.



๊ทธ๋Ÿฐ ๋’ค ํ•ด๋‹น ์ปจํ…Œ์ด๋„ˆ์— ์ ‘์†ํ•˜์—ฌ ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•ด ์ค๋‹ˆ๋‹ค.

./bin/elasticsearch-setup-passwords interactive


๊ทธ๋Ÿฌ๋ฉด Elastic Search ๋‚ด์—์„œ ์‚ฌ์šฉ๋˜๋Š” ๊ณ„์ •์— ๋Œ€ํ•œ ์ดˆ๊ธฐ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์–ด์š”.

 

 

 

 

        ๐Ÿ“ฆ ์ดˆ๊ธฐ ํ™˜๊ฒฝ ๊ตฌ์„ฑ - Kibana

cat dockerRunCommand_kibana.sh

 

docker run -d \
--name junyss-kibana \
--hostname junyss-kibana \
-p 5601:5601 \
-e "ES_JAVA_OPTS=-Xms1g -Xmx1g" \
-it -m 1GB \
--restart=unless-stopped \
-v /docker/dirMapping/kibana/config:/usr/share/kibana/config \
docker.elastic.co/kibana/kibana:8.10.2

 

์ตœ์ดˆ ์œ„์™€ ๊ฐ™์ด ๋ช…๋ น์–ด๋ฅผ ์ด์šฉํ•˜์—ฌ kibana Container(์ปจํ…Œ์ด๋„ˆ)๋ฅผ ๊ธฐ๋™ํ•ด ์ฃผ๋Š”๋ฐ,
Shell Script๋ฅผ ๋งŒ๋“ค์–ด์„œ ๊ด€๋ฆฌํ•˜๊ณ ์ž ์œ„์™€ ๊ฐ™์ด ๋งŒ๋“ค์–ด ์ฃผ์—ˆ์–ด์š”.

์œ„ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์ปจํ…Œ์ด๋„ˆ๋ฅผ ๋ฐฑ๊ทธ๋ผ์šด๋“œ๋กœ ๊ธฐ๋™ ์‹œํ‚ค๊ณ , Elasticsearch Java Option์„ ํ†ตํ•ด ์ตœ์†Œ ๋ฐ ์ตœ๋Œ€ Heap Memory Size๋ฅผ ๊ฐ๊ฐ 1GB๋กœ ์„ค์ •ํ•ด ์ฃผ์—ˆ์–ด์š”.

๊ทธ๋ฆฌ๊ณ , -m Option์„ ํ†ตํ•ด Container Memory Limit์„ 1GB๋กœ ์„ค์ •ํ•ด ์ฃผ์—ˆ์–ด์š”.

 

/docker/dirMapping/kibana/config

์œ„์™€ ๊ฐ™์ด Container ๋‚ด๋ถ€ ๋””๋ ‰ํ„ฐ๋ฆฌ์™€ Host ๋””๋ ‰ํ„ฐ๋ฆฌ ๋งคํ•‘ ์‹œ ๋“ค์–ด๊ฐˆ kibana.yml์„ ์ค€๋น„ํ•ด ์ฃผ์—ˆ์–ด์š”.

๊ทธ๋Ÿฐ ๋’ค ํ‚ค๋ฐ”๋‚˜ ๋„์ปค๋ฅผ ๊ธฐ๋™ ์‹œํ‚ค๋Š” Shell Script์— ์‹คํ–‰ ๊ถŒํ•œ์„ ์ฃผ๊ณ , ๊ธฐ๋™ ์‹œํ‚ค๋ฉด ๊ธฐ๋™์ด ๋œ๋‹ต๋‹ˆ๋‹ค.



 

 

 

 

        ๐Ÿ“ฆ ์ดˆ๊ธฐ ํ™˜๊ฒฝ ๊ตฌ์„ฑ - Logstash

cat dockerRunCommand_logstash.sh


Logstash ์—ญ์‹œ ๋ช…๋ น์–ด๋กœ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ๊ธฐ๋™ ์‹œํ‚ฌ๊ฑด๋ฐ, ๋ณด๋‹ค ํŽธ๋ฆฌํ•œ ๊ด€๋ฆฌ๋ฅผ ์œ„ํ•ด Shell Script๋กœ ๋งŒ๋“ค์–ด ์ฃผ์—ˆ์–ด์š”.

ํ‚ค๋ฐ”๋‚˜์™€ ๋‹ค๋ฅธ ์ ์€ LS_JAVA_OPTS ๋ถ€๋ถ„์ธ๋ฐ, ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์„ค์ • ๋ถ€๋ถ„์œผ๋กœ Logstash์˜ Java Option์„ ์„ค์ •ํ•˜์—ฌ ์ตœ์†Œ ๋ฐ ์ตœ๋Œ€ Heap Memory ํฌ๊ธฐ๋ฅผ ๊ฐ๊ฐ 256MB๋กœ ์„ค์ •ํ•˜๊ณ , ๋ณ‘๋ ฌ Thread ์ˆ˜๋ฅผ 1๋กœ ์„ค์ •ํ•ด ์ค€ ๋ถ€๋ถ„์ด์—์š”.


๊ทธ๋ฆฌ๊ณ , ์ปจํ…Œ์ด๋„ˆ Memory Limit์„ 256MB๋กœ ์ œํ•œํ•ด ์ฃผ์—ˆ์–ด์š”.


/docker/dirMapping/logstash/pipeline/logstash.conf

 

/docker/dirMapping/logstash/config

 

root@junyss-mng-service-ctn-host config(swift)# cat jvm.options
## JVM configuration

# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space

-Xms1g
-Xmx1g

################################################################
## Expert settings
################################################################
##
## All settings below this section are considered
## expert settings. Don't tamper with them unless
## you understand what you are doing
##
################################################################

## GC configuration
11-13:-XX:+UseConcMarkSweepGC
11-13:-XX:CMSInitiatingOccupancyFraction=75
11-13:-XX:+UseCMSInitiatingOccupancyOnly

## Locale
# Set the locale language
#-Duser.language=ko

# Set the locale country
#-Duser.country=KO

# Set the locale variant, if any
#-Duser.variant=

## basic

# set the I/O temp directory
#-Djava.io.tmpdir=$HOME

# set to headless, just in case
-Djava.awt.headless=true

# ensure UTF-8 encoding by default (e.g. filenames)
-Dfile.encoding=UTF-8

# use our provided JNA always versus the system one
#-Djna.nosys=true

# Turn on JRuby invokedynamic
-Djruby.compile.invokedynamic=true

## heap dumps

# generate a heap dump when an allocation from the Java heap fails
# heap dumps are created in the working directory of the JVM
-XX:+HeapDumpOnOutOfMemoryError

# specify an alternative path for heap dumps
# ensure the directory exists and has sufficient space
#-XX:HeapDumpPath=${LOGSTASH_HOME}/heapdump.hprof

## GC logging
#-Xlog:gc*,gc+age=trace,safepoint:file=@loggc@:utctime,pid,tags:filecount=32,filesize=64m

# log GC status to a file with time stamps
# ensure the directory exists
#-Xloggc:${LS_GC_LOG_FILE}

# Entropy source for randomness
-Djava.security.egd=file:/dev/urandom

# Copy the logging context from parent threads to children

 

 

root@junyss-mng-service-ctn-host config(swift)# cat log4j2.file.properties
status = error
name = LogstashPropertiesConfig

appender.console.type = Console
appender.console.name = plain_console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c]%notEmpty{[%X{pipeline.id}]}%notEmpty{[%X{plugin.id}]} %m%n

appender.json_console.type = Console
appender.json_console.name = json_console
appender.json_console.layout.type = JSONLayout
appender.json_console.layout.compact = true
appender.json_console.layout.eventEol = true

appender.rolling.type = RollingFile
appender.rolling.name = plain_rolling
appender.rolling.fileName = ${sys:ls.logs}/logstash-plain.log
appender.rolling.filePattern = ${sys:ls.logs}/logstash-plain-%d{yyyy-MM-dd}-%i.log.gz
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = true
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c]%notEmpty{[%X{pipeline.id}]}%notEmpty{[%X{plugin.id}]} %m%n
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.rolling.policies.size.size = 100MB
appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.max = 30
appender.rolling.avoid_pipelined_filter.type = PipelineRoutingFilter

appender.json_rolling.type = RollingFile
appender.json_rolling.name = json_rolling
appender.json_rolling.fileName = ${sys:ls.logs}/logstash-json.log
appender.json_rolling.filePattern = ${sys:ls.logs}/logstash-json-%d{yyyy-MM-dd}-%i.log.gz
appender.json_rolling.policies.type = Policies
appender.json_rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.json_rolling.policies.time.interval = 1
appender.json_rolling.policies.time.modulate = true
appender.json_rolling.layout.type = JSONLayout
appender.json_rolling.layout.compact = true
appender.json_rolling.layout.eventEol = true
appender.json_rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.json_rolling.policies.size.size = 100MB
appender.json_rolling.strategy.type = DefaultRolloverStrategy
appender.json_rolling.strategy.max = 30
appender.json_rolling.avoid_pipelined_filter.type = PipelineRoutingFilter

appender.routing.type = PipelineRouting
appender.routing.name = pipeline_routing_appender
appender.routing.pipeline.type = RollingFile
appender.routing.pipeline.name = appender-${ctx:pipeline.id}
appender.routing.pipeline.fileName = ${sys:ls.logs}/pipeline_${ctx:pipeline.id}.log
appender.routing.pipeline.filePattern = ${sys:ls.logs}/pipeline_${ctx:pipeline.id}.%i.log.gz
appender.routing.pipeline.layout.type = PatternLayout
appender.routing.pipeline.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %m%n
appender.routing.pipeline.policy.type = SizeBasedTriggeringPolicy
appender.routing.pipeline.policy.size = 100MB
appender.routing.pipeline.strategy.type = DefaultRolloverStrategy
appender.routing.pipeline.strategy.max = 30

rootLogger.level = ${sys:ls.log.level}
rootLogger.appenderRef.console.ref = ${sys:ls.log.format}_console
rootLogger.appenderRef.rolling.ref = ${sys:ls.log.format}_rolling
rootLogger.appenderRef.routing.ref = pipeline_routing_appender

# Slowlog

appender.console_slowlog.type = Console
appender.console_slowlog.name = plain_console_slowlog
appender.console_slowlog.layout.type = PatternLayout
appender.console_slowlog.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %m%n

appender.json_console_slowlog.type = Console
appender.json_console_slowlog.name = json_console_slowlog
appender.json_console_slowlog.layout.type = JSONLayout
appender.json_console_slowlog.layout.compact = true
appender.json_console_slowlog.layout.eventEol = true

appender.rolling_slowlog.type = RollingFile
appender.rolling_slowlog.name = plain_rolling_slowlog
appender.rolling_slowlog.fileName = ${sys:ls.logs}/logstash-slowlog-plain.log
appender.rolling_slowlog.filePattern = ${sys:ls.logs}/logstash-slowlog-plain-%d{yyyy-MM-dd}-%i.log.gz
appender.rolling_slowlog.policies.type = Policies
appender.rolling_slowlog.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling_slowlog.policies.time.interval = 1
appender.rolling_slowlog.policies.time.modulate = true
appender.rolling_slowlog.layout.type = PatternLayout
appender.rolling_slowlog.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %m%n
appender.rolling_slowlog.policies.size.type = SizeBasedTriggeringPolicy
appender.rolling_slowlog.policies.size.size = 100MB
appender.rolling_slowlog.strategy.type = DefaultRolloverStrategy
appender.rolling_slowlog.strategy.max = 30

appender.json_rolling_slowlog.type = RollingFile
appender.json_rolling_slowlog.name = json_rolling_slowlog
appender.json_rolling_slowlog.fileName = ${sys:ls.logs}/logstash-slowlog-json.log
appender.json_rolling_slowlog.filePattern = ${sys:ls.logs}/logstash-slowlog-json-%d{yyyy-MM-dd}-%i.log.gz
appender.json_rolling_slowlog.policies.type = Policies
appender.json_rolling_slowlog.policies.time.type = TimeBasedTriggeringPolicy
appender.json_rolling_slowlog.policies.time.interval = 1
appender.json_rolling_slowlog.policies.time.modulate = true
appender.json_rolling_slowlog.layout.type = JSONLayout
appender.json_rolling_slowlog.layout.compact = true
appender.json_rolling_slowlog.layout.eventEol = true
appender.json_rolling_slowlog.policies.size.type = SizeBasedTriggeringPolicy
appender.json_rolling_slowlog.policies.size.size = 100MB
appender.json_rolling_slowlog.strategy.type = DefaultRolloverStrategy
appender.json_rolling_slowlog.strategy.max = 30

logger.slowlog.name = slowlog
logger.slowlog.level = trace
logger.slowlog.appenderRef.console_slowlog.ref = ${sys:ls.log.format}_console_slowlog
logger.slowlog.appenderRef.rolling_slowlog.ref = ${sys:ls.log.format}_rolling_slowlog
logger.slowlog.additivity = false

logger.licensereader.name = logstash.licensechecker.licensereader
logger.licensereader.level = error

# Silence http-client by default
logger.apache_http_client.name = org.apache.http
logger.apache_http_client.level = fatal

# Deprecation log
appender.deprecation_rolling.type = RollingFile
appender.deprecation_rolling.name = deprecation_plain_rolling
appender.deprecation_rolling.fileName = ${sys:ls.logs}/logstash-deprecation.log
appender.deprecation_rolling.filePattern = ${sys:ls.logs}/logstash-deprecation-%d{yyyy-MM-dd}-%i.log.gz
appender.deprecation_rolling.policies.type = Policies
appender.deprecation_rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.deprecation_rolling.policies.time.interval = 1
appender.deprecation_rolling.policies.time.modulate = true
appender.deprecation_rolling.layout.type = PatternLayout
appender.deprecation_rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c]%notEmpty{[%X{pipeline.id}]}%notEmpty{[%X{plugin.id}]} %m%n
appender.deprecation_rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.deprecation_rolling.policies.size.size = 100MB
appender.deprecation_rolling.strategy.type = DefaultRolloverStrategy
appender.deprecation_rolling.strategy.max = 30

logger.deprecation.name = org.logstash.deprecation, deprecation
logger.deprecation.level = WARN
logger.deprecation.appenderRef.deprecation_rolling.ref = deprecation_plain_rolling
logger.deprecation.additivity = false

logger.deprecation_root.name = deprecation
logger.deprecation_root.level = WARN
logger.deprecation_root.appenderRef.deprecation_rolling.ref = deprecation_plain_rolling
logger.deprecation_root.additivity = false

 

 

root@junyss-mng-service-ctn-host config(swift)# cat log4j2.properties
status = error
name = LogstashPropertiesConfig

appender.console.type = Console
appender.console.name = plain_console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c]%notEmpty{[%X{pipeline.id}]}%notEmpty{[%X{plugin.id}]} %m%n

appender.json_console.type = Console
appender.json_console.name = json_console
appender.json_console.layout.type = JSONLayout
appender.json_console.layout.compact = true
appender.json_console.layout.eventEol = true

rootLogger.level = ${sys:ls.log.level}
rootLogger.appenderRef.console.ref = ${sys:ls.log.format}_console

 

cat logstash.yml

http.host: "0.0.0.0"
xpack.monitoring.elasticsearch.hosts: [ "http://{Elastic Search IP}:9200" ]

## X-Pack security credentials
xpack.monitoring.enabled: true
xpack.monitoring.elasticsearch.username: elastic
xpack.monitoring.elasticsearch.password: PASSWORD

 

 

cat pipelines.yml

 

# This file is where you define your pipelines. You can define multiple.
# For more information on multiple pipelines, see the documentation:
#   https://www.elastic.co/guide/en/logstash/current/multiple-pipelines.html

- pipeline.id: main
  path.config: "/usr/share/logstash/pipeline"

 

 

root@junyss-mng-service-ctn-host config(swift)# cat startup.options
################################################################################
# These settings are ONLY used by $LS_HOME/bin/system-install to create a custom
# startup script for Logstash and is not used by Logstash itself. It should
# automagically use the init system (systemd, upstart, sysv, etc.) that your
# Linux distribution uses.
#
# After changing anything here, you need to re-run $LS_HOME/bin/system-install
# as root to push the changes to the init script.
################################################################################

# Override Java location
#JAVACMD=/usr/bin/java

# Set a home directory
LS_HOME=/usr/share/logstash

# logstash settings directory, the path which contains logstash.yml
LS_SETTINGS_DIR=/etc/logstash

# Arguments to pass to logstash
LS_OPTS="--path.settings ${LS_SETTINGS_DIR}"

# Arguments to pass to java
LS_JAVA_OPTS=""

# pidfiles aren't used the same way for upstart and systemd; this is for sysv users.
LS_PIDFILE=/var/run/logstash.pid

# user and group id to be invoked as
LS_USER=logstash
LS_GROUP=logstash

# Enable GC logging by uncommenting the appropriate lines in the GC logging
# section in jvm.options
LS_GC_LOG_FILE=/var/log/logstash/gc.log

# Open file limit
LS_OPEN_FILES=16384

# Nice level
LS_NICE=19

# Change these to have the init script named and described differently
# This is useful when running multiple instances of Logstash on the same
# physical box or vm
SERVICE_NAME="logstash"
SERVICE_DESCRIPTION="logstash"

# If you need to run a command or script before launching Logstash, put it
# between the lines beginning with `read` and `EOM`, and uncomment those lines.
###
## read -r -d '' PRESTART << EOM
## EOM

 

์œ„์™€ ๊ฐ™์ด Logstash ๊ด€๋ จ ๊ตฌ์„ฑ ํŒŒ์ผ๋“ค์„ ๋ฏธ๋ฆฌ ์ƒ์„ฑํ•ด์„œ ๋„ฃ์–ด๋‘๊ณ ,
์ปจํ…Œ์ด๋„ˆ์™€ ๋””๋ ‰ํ„ฐ๋ฆฌ ๋งคํ•‘์„ ํ†ตํ•ด ์ „๋‹ฌ ๋  ์ˆ˜ ์žˆ๋„๋ก ์„ค์ •ํ•ด ์ฃผ์—ˆ์–ด์š”.


๊ทธ๋Ÿฐ ๋’ค ์ปจํ…Œ์ด๋„ˆ ๊ธฐ๋™ ๋ช…๋ น์–ด๊ฐ€ ๋“ค์–ด์žˆ๋Š” Script์˜ ์‹คํ–‰ ๊ถŒํ•œ์„ ์ฃผ๊ณ , ์‹คํ–‰ํ•˜๊ฒŒ ๋˜๋ฉด ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์ƒ์„ฑ๋  ๊ฑฐ์—์š”.

 

docker ps -a

 

 

 

 

 

 

    ๐Ÿ”ฝ ์ดˆ๊ธฐ ํ™˜๊ฒฝ ๊ตฌ์„ฑ - Agent(beat)

wget -O - https://artifacts.elastic.co/GPG-KEY-elasticsearch | gpg --dearmor -o /etc/apt/keyrings/elasticsearch-keyring.gpg

์ตœ์ดˆ ๊ฐ beat(๋น„ํŠธ)๋ฅผ ๋‚ด๋ ค๋ฐ›๊ธฐ ์œ„ํ•ด์„œ๋Š” ์œ„์™€ ๊ฐ™์ด gpg Key๋ฅผ ๋‚ด๋ ค ๋ฐ›์•„ ์ฃผ์–ด์•ผ ํ•ด์š”.

1. wget -O - https://artifacts.elastic.co/GPG-KEY-elasticsearch   

  - wget: ์›น์—์„œ ํŒŒ์ผ ๋‚ด๋ ค ๋ฐ›์„ ๋•Œ ์‚ฌ์šฉํ•˜๋Š” ๋ช…๋ น์–ด. Elastci.co ์›น ์‚ฌ์ดํŠธ์—์„œ GPG-KEY_elasticsearch File
                ๋‚ด๋ ค ๋ฐ›๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ.

  - -O -: ๋‚ด๋ ค ๋ฐ›๊ธฐํ•œ Data๋ฅผ ํ‘œ์ค€ ์ถœ๋ ฅ(STDOUT)์œผ๋กœ ์ถœ๋ ฅํ•˜๋„๋ก ์ง€์‹œ. ์ฆ‰, ๋‚ด๋ ค๋ฐ›๊ธฐํ•œ Data๋ฅผ ํ™”๋ฉด์— ์ถœ๋ ฅ.
  - " : Pipe ๊ธฐํ˜ธ๋ฅผ ํ†ตํ•ด ์ด์ „ ๋ช…๋ น์–ด์˜ ๊ฒฐ๊ณผ๋ฅผ ๋‹ค์Œ ๋ช…๋ น์–ด์˜ ์ž…๋ ฅ์œผ๋กœ ๋ณด๋‚ด๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ.

2. gpg --dearmor -o /etc/apt/keyrings/elasticsearch-keyring.gpg

  - gpg: GNU Privacy Guard(GPG) ์‹คํ–‰ ์‹œ ์‚ฌ์šฉ. GPG๋Š” ์•”ํ˜ธํ™”์™€ ๋””์ง€ํ„ธ ์„œ๋ช… ๋‹ค๋ฃฐ ๋•Œ ์‚ฌ์šฉ.
  - --dearmor: GPG ํ‚ค๋ฅผ Decodingํ•˜์—ฌ Binary ํ˜•์‹์—์„œ ASCII ํ˜•์‹์œผ๋กœ ๋ณ€ํ™˜ํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ.
  - -o /etc/apt/keyrings/elasticsearch-keyring.gpg: Decoding๋œ GPG ํ‚ค๋ฅผ /etc/apt/keyrings ๋””๋ ‰ํ„ฐ๋ฆฌ์—
     elasticsearch-keyring.gpg File๋กœ ์ €์žฅํ•˜๋„๋ก ์ง€์‹œ. ์ด Directory ์™€ File์€ APT Package ๊ด€๋ฆฌ์ž์—์„œ ์‚ฌ์šฉ๋˜๋Š”
     GPG ํ‚ค ์ €์žฅ ์‹œ ์‚ฌ์šฉ.

์œ„ ๋ช…๋ น์–ด๋Š” Elastic.co์˜ GPG ํ‚ค๋ฅผ ๋‚ด๋ ค ๋ฐ›์•„ System(์‹œ์Šคํ…œ)์˜ APT Package(ํŒจํ‚ค์ง€) ๊ด€๋ฆฌ์ž์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก GPG ํ˜•์‹์—์„œ ASCII ํ˜•์‹์œผ๋กœ ๋ณ€ํ™˜ํ•˜๊ณ , /etc/apt/keyrings/ Directory(๋””๋ ‰ํ„ฐ๋ฆฌ)์— elasticsearch-keyring.gpg File(ํŒŒ์ผ)๋กœ ์ €์žฅํ•˜๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•œ ๋ช…๋ น์–ด์—์š”. ์ด๋ฅผ ํ†ตํ•ด ElastciSearch์™€ ๊ด€๋ จ๋œ ํŒจํ‚ค์ง€๋ฅผ ์•ˆ์ „ํ•˜๊ฒŒ ์„ค์น˜ํ•˜๊ณ , ์—…๋ฐ์ดํŠธํ•  ์ˆ˜ ์žˆ์–ด์š”.

 

echo "deb [signed-by=/etc/apt/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | tee /etc/apt/sources.list.d/elastic-8.x.list

์œ„ ๋ช…๋ น์–ด๋Š” APT ํŒจํ‚ค์ง€ ๊ด€๋ฆฌ์ž๋ฅผ ํ†ตํ•ด ElasticSearch์˜ ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•˜๊ฑฐ๋‚˜,
์—…๋ฐ์ดํŠธํ•˜๊ธฐ ์œ„ํ•œ APT ์ €์žฅ์†Œ ์ถ”๊ฐ€ ๋ช…๋ น์–ด์—์š”.

1. echo "deb [signed-by=/etc/apt/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main"  

  - echo: ์ธ์ˆ˜๋กœ ์ „๋‹ฌ๋œ ๋ฌธ์ž์—ด ํ‘œ์ค€ ์ถœ๋ ฅ. ElasticSearch ํŒจํ‚ค์ง€ ์ €์žฅ์†Œ์— ๋Œ€ํ•œ APT Source ๋ชฉ๋ก ์ •์˜๋ฅผ ์œ„ํ•ด ์‚ฌ์šฉ.
  - deb: Debian ํŒจํ‚ค์ง€ ํ˜•์‹ ํ‘œํ˜„.
  - [signed-by=/etc/apt/keyrings/elasticsearch-keyring.gpg]: GPG ํ‚ค๊ฐ€
     /etc/apt/keyrings/elasticsearch-keyring.gpg ํŒŒ์ผ๋กœ ์„œ๋ช…๋˜์—ˆ์Œ์„ ํ‘œํ˜„. ์ด๊ฒƒ์€ GPG ํ‚ค์˜ ์œ ํšจ์„ฑ์„ ๊ฒ€์ฆํ•˜์—ฌ
     ํŒจํ‚ค์ง€์˜ ๋ฌด๊ฒฐ์„ฑ ๋ณด์žฅ.
  - https://artifacts.elastic.co/packages/8.x/apt: ElasticSearch ํŒจํ‚ค์ง€ ์ €์žฅ์†Œ์˜ URL.
  - stable: ElasticSearch ํŒจํ‚ค์ง€ ์•ˆ์ • ๋ฒ„์ „ ํ‘œํ˜„.
  - main: ์ €์žฅ์†Œ์—์„œ ์‚ฌ์šฉํ•œ Main Component ํ‘œํ˜„.

2. tee /etc/apt/sources.list.d/elastic-8.x.list

  - tee: ํ‘œ์ค€ ์ž…๋ ฅ์—์„œ ์ฝ์€ Data๋ฅผ ํŒŒ์ผ์— ์“ธ ๋•Œ ์‚ฌ์šฉ.
  - /etc/apt/sources.list.d/elastic-8.x.list: ์•ž์—์„œ ์ •์˜ํ•œ ElasticSearch ํŒจํ‚ค์ง€ ์ €์žฅ์†Œ ์ •๋ณด๋ฅผ ํ•ด๋‹น ํŒŒ์ผ์— ์“ฐ๋„๋ก
    ์ง€์‹œ. ์ด ํŒŒ์ผ์€ APT ํŒจํ‚ค์ง€ ๊ด€๋ฆฌ์ž์—๊ฒŒ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ Source ๋ชฉ๋ก ์ค‘ ํ•˜๋‚˜๋กœ ์ธ์‹๋˜๋ฉฐ, ์ด ์ €์žฅ์†Œ์—์„œ ํŒจํ‚ค์ง€ ์„ค์น˜ ๋ฐ
    ์—…๋ฐ์ดํŠธ.

์œ„ ๋ช…๋ น์–ด๋Š” ElastciSearch ํŒจํ‚ค์ง€ ์ €์žฅ์†Œ๋ฅผ APT ํŒจํ‚ค์ง€ ๊ด€๋ฆฌ์ž์— ์ถ”๊ฐ€ํ•˜๊ณ , ํ•ด๋‹น ์ €์žฅ์†Œ์—์„œ ์ œ๊ณตํ•˜๋Š” ํŒจํ‚ค์ง€๋ฅผ ์‹œ์Šคํ…œ์— ์„ค์น˜ ๋ฐ ์—…๋ฐ์ดํŠธ ํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ๋ช…๋ น์–ด์—์š”.

 

apt update



apt-get update && apt-get upgrade -y

 

๊ทธ๋Ÿฐ ๋’ค ์œ„์™€ ๊ฐ™์ด ํŒจํ‚ค์ง€๋ฅผ ์ตœ์‹ ํ™” ํ•˜์—ฌ ์ฃผ์—ˆ์–ด์š”.

 

 

 

        ๐Ÿ“ฆ filebeat

apt install filebeat metricbeat auditbeat packetbeat

 

์œ„์™€ ๊ฐ™์ด ๊ฐ beat๋“ค์„ ๋จผ์ € ์„ค์น˜ํ•ด ์ค๋‹ˆ๋‹ค.

vim /etc/filebeat/filebeat.yml [filebeat inputs]

 

28๋ฒˆ์งธ ์ค„์— enabled ๋ถ€๋ถ„์„ true๋กœ ๋ฐ”๊ฟ”์ค๋‹ˆ๋‹ค.

Paths ๋ถ€๋ถ„์—๋Š” Logging ํ•˜๊ณ ์ž ํ•˜๋Š” Log File์— ์œ„์น˜๋ฅผ ๋ช…์‹œํ•ด ์ฃผ๋ฉด ๋ผ์š”.

vim /etc/filebeat/filebeat.yml [kibana]

setup.kibana:

  # Kibana Host
  # Scheme and port can be left out and will be set to the default (http and 5601)
  # In case you specify and additional path, the scheme is required: http://localhost:5601/path
  # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
  host: "192.168.20.253:5601"


115๋ฒˆ์งธ ์ค„์— Kibana์˜ IP์ฃผ์†Œ๋ฅผ ์ ์–ด์ฃผ๊ณ , Kibana์˜ Port ๋ฒˆํ˜ธ๋ฅผ ๋ช…์‹œํ•ด ์ค๋‹ˆ๋‹ค.

 

vim /etc/filebeat/filebeat.yml [Elasticsearch Output]

 

output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["192.168.20.254:9200"]

  # Protocol - either `http` (default) or `https`.
  protocol: "http"

  # Authentication credentials - either API key or username/password.
  #api_key: "id:api_key"
  username: "elastic"
  password: "changeme"


142๋ฒˆ์งธ ์ค„์— Elastic Search IP์™€ Port ๋ฒˆํ˜ธ๋ฅผ ์ ์–ด์ฃผ๊ณ , ํ†ต์‹ ์‹œ ์‚ฌ์šฉ๋˜๋Š” Protocol์„ 145๋ฒˆ์งธ ์ค„์— ์ž‘์„ฑํ•ด ์ฃผ์—ˆ์–ด์š”.
๊ทธ๋ฆฌ๊ณ , 149~150๋ฒˆ์งธ์—๋Š” Elastic Search ๊ณ„์ •์„ ์ž…๋ ฅํ•ด ์ค๋‹ˆ๋‹ค.

 

vim /etc/filebeat/filebeat.yml [Logging]

logging.level: info
logging.to_files: true
logging.files:
  path: /var/log/filebeat
  name: filebeat
  keepfiles: 7
  permissions: 0640


filebeat์— ๋Œ€ํ•œ Log๋ฅผ ๋‚จ๊ธฐ๊ธฐ ์œ„ํ•ด ์œ„์™€ ๊ฐ™์ด ์ž‘์„ฑํ•ด ์ฃผ์—ˆ์–ด์š”.

 

filebeat setup -e -E output.logstash.enabled=false -E output.elasticsearch.hosts=['Elastic Search IP:9200'] -E setup.kibana.host=Kibana IP:5601


์ฃผ๋‹ˆ๋Š” Elastic Search์™€ Kibana, Logstash๊ฐ€ ๋‹ค๋ฅธ ์„œ๋ฒ„์— ๋”ฐ๋กœ ์„ค์น˜ ๋˜์–ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์œ„ ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•ด ์ฃผ์—ˆ์–ด์š”.

์œ„ ๋ช…๋ น์–ด๋Š” filebeat๋ฅผ ์„ค์ •ํ•˜๊ณ , ์‹คํ–‰ํ•˜๋Š” ๋ช…๋ น์–ด๋กœ Elastic Search์™€ Kibana์™€์˜ ํ†ตํ•ฉ์„ ์„ค์ •ํ•˜๋Š”๋ฐ,
์‚ฌ์šฉํ•˜๋Š” ๋ช…๋ น์–ด์—์š”.

 

1. filebeat setup

  - setup: filebeat ์ดˆ๊ธฐ ์„ค์ • ๊ตฌ์„ฑ ๋ฐ ํ•„์š”ํ•œ ์ž์› ์ƒ์„ฑ.
  - -e: ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•  ๋•Œ, Logging์„ ํ™œ์„ฑํ™”ํ•˜๊ณ , filebeat Log ํ‘œ์‹œ๋ฅผ ์œ„ํ•ด ์‚ฌ์šฉ.

2. -E output.logstash.enabled=false:

  - -E: filebeat ์„ค์ • ์ง€์ •์„ ์œ„ํ•ด ์‚ฌ์šฉ. output.logstash.enabled=false๋ฅผ ํ†ตํ•ด Logstash๋ฅผ ํ†ตํ•œ ์ถœ๋ ฅ์„ ๋น„ํ™œ์„ฑํ™”ํ•˜๊ณ ,
           Logstash๋กœ ๋ฐ์ดํ„ฐ ์ „์†ก ๋ฐฉ์ง€. ์ฆ‰, ๋ฐ์ดํ„ฐ๋ฅผ Logstash๋ฅผ ๊ฑฐ์น˜์ง€ ์•Š๊ณ , ๋ฐ”๋กœ Elastic Search์— ์ €์žฅ.

3. -E output.elasticsearch.hosts=['Elastic Search IP':'Elastic Search Port']: Elastic Search๋กœ์˜ ์ถœ๋ ฅ ์ง€์ •.

4. -E setup.kibana.host=Kibana IP:Kibana Port: Kibana Host ์ง€์ •ํ•˜์—ฌ filebeat๋ฅผ Kibana์™€ ์—ฐ๋™



๋งŒ์•ฝ ๋ชจ๋‘ ๊ฐ™์€ ์„œ๋ฒ„์— ์„ค์น˜ ๋˜์–ด ์žˆ๋‹ค๋ฉด ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ๋ผ์š”.

filebeat setup -e  # -e : debug mode

 

 

systemctl enable --now filebeat


์œ„ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด filebeat๋ฅผ ๋ถ€ํŒ… ์‹œ ์ž๋™์œผ๋กœ ์„œ๋น„์Šค๋˜๊ฒŒ ์„œ๋น„์Šค์— ๋“ฑ๋กํ•ด ์ฃผ๊ณ , ๋ฐ”๋กœ Daemon(๋ฐ๋ชฌ)์„ ๊ธฐ๋™ ์‹œ์ผœ ์ฃผ์—ˆ์–ด์š”.

 

 

Kibana: Analytics -> Discover


์œ„์™€ ๊ฐ™์ด Kibana์— ์ ‘์†ํ•˜์—ฌ ์™ผ์ชฝ Navigator์—์„œ Analytics์— Discover๋ฅผ ๋“ค์–ด๊ฐ€ ์ค๋‹ˆ๋‹ค.

 

 


๊ทธ๋Ÿผ ์œ„์™€ ๊ฐ™์ด filebeat-* ๊ฐ€ ์ƒ๊ธด๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.



์œ„์™€ ๊ฐ™์ด Log๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

 

 

 

 

        ๐Ÿ“ฆ metricbeat

ํŒจํ‚ค์ง€๋Š” ์œ„ filebeat์—์„œ ์„ค์น˜ํ–ˆ๊ธฐ ๋•Œ๋ฌธ์— ์ด๋ฏธ ์„ค์น˜๊ฐ€ ๋˜์–ด ์žˆ๋Š” ์ƒํƒœ์—์š”.

vim /etc/metricbeat/metricbeat.yml [kibana]

setup.kibana:

  # Kibana Host
  # Scheme and port can be left out and will be set to the default (http and 5601)
  # In case you specify and additional path, the scheme is required: http://localhost:5601/path
  # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
  host: "192.168.20.253:5601"



Kibana์˜ IP์ฃผ์†Œ๋ฅผ ์ ์–ด์ฃผ๊ณ , Kibana์˜ Port ๋ฒˆํ˜ธ๋ฅผ ๋ช…์‹œํ•ด ์ค๋‹ˆ๋‹ค.

 

vim /etc/metricbeat/metricmeat.yml [Elasticsearch Output]

 

output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["192.168.20.254:9200"]

  # Protocol - either `http` (default) or `https`.
  protocol: "http"

  # Authentication credentials - either API key or username/password.
  #api_key: "id:api_key"
  username: "elastic"
  password: "changeme"

 

Elastic Search IP์™€ Port ๋ฒˆํ˜ธ๋ฅผ ์ ์–ด์ฃผ๊ณ , ํ†ต์‹ ์‹œ ์‚ฌ์šฉ๋˜๋Š” Protocol์„ ์ž‘์„ฑํ•ด ์ฃผ์—ˆ์–ด์š”.
๊ทธ๋ฆฌ๊ณ , Elastic Search ๊ณ„์ •์„ ์ž…๋ ฅํ•ด ์ค๋‹ˆ๋‹ค.

 

 

vim /etc/metricbeat/metricmeat.yml [Logging]

 

logging.level: info
logging.to_files: true
logging.files:
  path: /var/log/metricbeat
  name: metricbeat
  keepfiles: 7
  permissions: 0640

 

metricbeat์— ๋Œ€ํ•œ Log๋ฅผ ๋‚จ๊ธฐ๊ธฐ ์œ„ํ•ด ์œ„์™€ ๊ฐ™์ด ์ž‘์„ฑํ•ด ์ฃผ์—ˆ์–ด์š”.

 

metricbeat modules list

 

์œ„์™€ ๊ฐ™์ด ๋ชจ๋‹ˆํ„ฐ๋ง ๋Œ€์ƒ ์„œ๋น„์Šค์— ๋Œ€ํ•ด ๋ชจ๋“ˆ ๋ชฉ๋ก์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

 

# ๋ชจ๋“ˆ ์ถ”๊ฐ€
metricbeat modules enable <module-name>

# ๋ชจ๋“ˆ ์ œ๊ฑฐ
metricbeat modules disable <module-name>

 



system์€ ๊ธฐ๋ณธ์ ์œผ๋กœ ์ถ”๊ฐ€๊ฐ€ ๋˜์–ด ์žˆ๊ณ , ์œ„์™€ ๊ฐ™์ด ๋ชจ๋‹ˆํ„ฐ๋ง ํ•˜๊ณ ์ž ํ•˜๋Š” ๊ฒƒ๋“ค์„ ์ถ”๊ฐ€ํ•ด ์ค„ ์ˆ˜ ์žˆ์–ด์š”.

 

metricbeat test config

 

metricbeat test modules

 

 

metricbeat test output

 

์œ„์™€ ๊ฐ™์ด ์ •์ƒ์ ์œผ๋กœ ํ†ต์‹ ์ด ๋˜๋Š”์ง€ test ํ•ด๋ณผ ์ˆ˜ ์žˆ์–ด์š”.

 



metricbeat setup -e -E output.logstash.enabled=false -E output.elasticsearch.hosts=['์—˜๋ผ์Šคํ‹ฑ ์„œ์น˜ IP:9200'] -E setup.kibana.host=ํ‚ค๋ฐ”๋‚˜ IP:5601



์ฃผ๋‹ˆ๋Š” Elastic Search์™€ Kibana, Logstash๊ฐ€ ๋‹ค๋ฅธ ์„œ๋ฒ„์— ๋”ฐ๋กœ ์„ค์น˜ ๋˜์–ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์œ„ ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•ด ์ฃผ์—ˆ์–ด์š”.

์œ„ ๋ช…๋ น์–ด๋Š” metricbeat๋ฅผ ์„ค์ •ํ•˜๊ณ , ์‹คํ–‰ํ•˜๋Š” ๋ช…๋ น์–ด๋กœ Elastic Search์™€ Kibana์™€์˜ ํ†ตํ•ฉ์„ ์„ค์ •ํ•˜๋Š”๋ฐ,
์‚ฌ์šฉํ•˜๋Š” ๋ช…๋ น์–ด์—์š”.

 

๋งŒ์•ฝ ๋ชจ๋‘ ๊ฐ™์€ ์„œ๋ฒ„์— ์„ค์น˜ ๋˜์–ด ์žˆ๋‹ค๋ฉด ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ๋ผ์š”.

metricbeat setup -e

 

systemctl enable --now metricbeat


์œ„ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด metricbeat๋ฅผ ๋ถ€ํŒ… ์‹œ ์ž๋™์œผ๋กœ ์„œ๋น„์Šค๋˜๊ฒŒ ์„œ๋น„์Šค์— ๋“ฑ๋กํ•ด ์ฃผ๊ณ ,
๋ฐ”๋กœ Daemon(๋ฐ๋ชฌ)์„ ๊ธฐ๋™ ์‹œ์ผœ ์ฃผ์—ˆ์–ด์š”.




Kibana: Analytics -> Discover


์œ„์™€ ๊ฐ™์ด metricmeat-*๊ฐ€ ์ƒ๊ธด๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.


Kibana: Analytics -> Dashboard



๊ฒ€์ƒ‰:Metricbeat System Overview ECS

 

 

Metricbeat System Overview ECS -> System Overview


์ด๋ฏธ ์ฃผ๋‹ˆ๋Š” ๋ช‡ ๊ฐœ์˜ ์„œ๋ฒ„๋ฅผ ๋“ฑ๋กํ•ด๋†จ๊ธฐ ๋•Œ๋ฌธ์— ์œ„์™€ ๊ฐ™์ด ํ˜ธ์ŠคํŠธ ๊ฐœ์ˆ˜๊ฐ€ 4๊ฐœ๋กœ ์ฐํžˆ๊ณ  ์žˆ๊ณ , ์œ„์—์„œ ๋“ฑ๋กํ•œ ์„œ๋ฒ„ ํ˜ธ์ŠคํŠธ junyss-os-controller๊ฐ€ ๋ณด์ด๋Š”๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.



Metricbeat System Overview ECS -> Host Overview(junyss-os-controller)

 

Metricbeat System Overview ECS -> Host Overview(junyss-os-controller)

 

Metricbeat System Overview ECS -> Host Overview(junyss-os-controller)

 

Metricbeat System Overview ECS -> Host Overview(junyss-os-controller)



์œ„์™€ ๊ฐ™์ด ์„œ๋ฒ„ ์‚ฌ์šฉ๋Ÿ‰์— ๋Œ€ํ•ด ๋‹ค์–‘ํ•œ ํ™•์ธ์„ ํ•  ์ˆ˜ ์žˆ์–ด์š”.

 

 

 

 

        ๐Ÿ“ฆ auditbeat

ํŒจํ‚ค์ง€๋Š” ์œ„ filebeat์—์„œ ์„ค์น˜ํ–ˆ๊ธฐ ๋•Œ๋ฌธ์— ์ด๋ฏธ ์„ค์น˜๊ฐ€ ๋˜์–ด ์žˆ๋Š” ์ƒํƒœ์—์š”.

vim /etc/auditbeat/auditbeat.yml [kibana]

 

setup.kibana:

  # Kibana Host
  # Scheme and port can be left out and will be set to the default (http and 5601)
  # In case you specify and additional path, the scheme is required: http://localhost:5601/path
  # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
  host: "192.168.20.253:5601"

 

vim /etc/auditbeat/auditbeat.yml [Elasticsearch Output]

 

# ---------------------------- Elasticsearch Output ----------------------------
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["192.168.20.254:9200"]

  # Protocol - either `http` (default) or `https`.
  protocol: "http"

  # Authentication credentials - either API key or username/password.
  #api_key: "id:api_key"
  username: "elastic"
  password: "password"

 

vim /etc/auditbeat/auditbeat.yml [Logging]

logging.level: info
logging.to_files: true
logging.files:
  path: /var/log/auditbeat
  name: auditbeat
  keepfiles: 7
  permissions: 0640


์œ„์— ๋‹ค๋ฅธ ๋น„ํŠธ๋“ค๊ณผ ๋™์ผํ•˜๊ฒŒ ์„ค์ • ํŒŒ์ผ์„ ๊ตฌ์„ฑํ•ด ์ฃผ์—ˆ์–ด์š”.

 

auditbeat setup -e -E output.logstash.enabled=false -E output.elasticsearch.hosts=['์—˜๋ผ์Šคํ‹ฑ ์„œ์น˜ IP:9200'] -E setup.kibana.host=ํ‚ค๋ฐ”๋‚˜ IP:5601

 

systemctl enable --now auditbeat


์œ„์™€ ๊ฐ™์ด auditbeat ๋ฐ๋ชฌ์„ ๊ธฐ๋™ ์‹œํ‚ค๊ณ , ์„œ๋น„์Šค์— ๋“ฑ๋กํ•ด ์ฃผ์—ˆ์–ด์š”.

 

Kibana -> Discover


ํ‚ค๋ฐ”๋‚˜์— ์œ„์™€ ๊ฐ™์ด auditbeat-*๊ฐ€ ์ƒ๊ธด๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

 

๊ฒ€์ƒ‰:&nbsp;Auditbeat System System Overview ECS


ํ‚ค๋ฐ”๋‚˜์— Dashboards์—์„œ ์œ„์™€ ๊ฐ™์ด ๊ฒ€์ƒ‰ํ•˜๋ฉด ๊ฐ์‚ฌ ๊ด€๋ จ ๋ชจ๋‹ˆํ„ฐ๋ง์„ ํ•  ์ˆ˜ ์žˆ์–ด์š”.

 

Auditbeat System Overview ECS -> System Overview

 

 

 

 

 

        ๐Ÿ“ฆ packetbeat

ํŒจํ‚ค์ง€๋Š” ์œ„ filebeat์—์„œ ์„ค์น˜ํ–ˆ๊ธฐ ๋•Œ๋ฌธ์— ์ด๋ฏธ ์„ค์น˜๊ฐ€ ๋˜์–ด ์žˆ๋Š” ์ƒํƒœ์—์š”.

vim /etc/packetbeat/packetbeat.yml [kibana]

setup.kibana:

  # Kibana Host
  # Scheme and port can be left out and will be set to the default (http and 5601)
  # In case you specify and additional path, the scheme is required: http://localhost:5601/path
  # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
  host: "192.168.20.253:5601"

 

vim /etc/packetbeat/packetbeat.yml [Elasticsearch Output]

 

output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["192.168.20.254:9200"]

  # Protocol - either `http` (default) or `https`.
  protocol: "http"

  # Authentication credentials - either API key or username/password.
  #api_key: "id:api_key"
  username: "elastic"
  password: "changeme"

 

vim /etc/packetbeat/packetbeat.yml [Logging]

logging.level: info
logging.to_files: true
logging.files:
  path: /var/log/packetbeat
  name: packetbeat
  keepfiles: 7
  permissions: 0640

 

์œ„ ๋‚ด์šฉ๋„ ๋‹ค๋ฅธ ๋น„ํŠธ์ฒ˜๋Ÿผ ๋™์ผํ•˜๊ฒŒ ์ˆ˜์ •ํ•ด ์ฃผ์—ˆ์–ด์š”.

 

packetbeat setup -e -E output.logstash.enabled=false -E output.elasticsearch.hosts=['์—˜๋ผ์Šคํ‹ฑ ์„œ์น˜ IP:9200'] -E setup.kibana.host=ํ‚ค๋ฐ”๋‚˜ IP:5601



systemctl enable --now packetbeat


packetbeat๋„ ์„œ๋น„์Šค์— ๋“ฑ๋กํ•˜๊ณ , ๊ธฐ๋™ ์‹œ์ผœ ์ค๋‹ˆ๋‹ค.

 


ํ‚ค๋ฐ”๋‚˜์— Discover์— ์œ„์™€ ๊ฐ™์ด packetbeat-*๊ฐ€ ๋งŒ๋“ค์–ด์ง„๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

 

 

๊ฒ€์ƒ‰:&nbsp;Packetbeat Overview ECS


Dashboards์—์„œ ์œ„์™€ ๊ฐ™์ด ๊ฒ€์ƒ‰์„ ํ•˜์—ฌ Dashboard๋ฅผ ํ™•์ธํ•ด ์ค„๊ฒŒ์š”.

 


์œ„์™€ ๊ฐ™์ด Network ๊ด€๋ จ ๋ชจ๋‹ˆํ„ฐ๋ง์„ ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜์—ˆ์–ด์š”.

 

 

 

 

        ๐Ÿ“ฆ heartbeat-elastic

apt install heartbeat-elastic

์ตœ์ดˆ ์œ„์™€ ๊ฐ™์ด ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•ด ์ค๋‹ˆ๋‹ค.



vim /etc/heartbeat/heartbeat.yml [Heartbeat]

 

- type: icmp
  schedule: '59 * * * * * *'
  hosts:
    - "192.168.0.2"
    - "192.168.0.3"
    - "192.168.0.4"
    - "192.168.20.2"
    - "192.168.20.3"
    - "192.168.20.4"
    - "192.168.20.5"
    - "192.168.20.251"
    - "192.168.20.252"
    - "192.168.20.254"
    - "192.168.30.2"
  id: junyss-icmp-service
  name: Junyss ICMP Service


์ตœ์ดˆ ์œ„์™€ ๊ฐ™์ด Ping Test๋ฅผ ์ด์šฉํ•˜์—ฌ ํ•ด๋‹น ์„œ๋ฒ„๊ฐ€ ์‚ด์•„์žˆ๋Š”์ง€ ํ™•์ธํ•  ๋Œ€์ƒ ์„œ๋ฒ„์˜ IP๋ฅผ ์ž‘์„ฑํ•ด ์ฃผ์—ˆ์–ด์š”.

schedule์—๋Š” Linux Crontab ๋ฐฉ์‹์œผ๋กœ ์ž‘๋™ ์‹œ๊ฐ„์„ ์„ค์ •ํ•ด ์ฃผ์—ˆ๋Š”๋ฐ,
์ฃผ๋‹ˆ๋Š” ๋งค 59๋ถ„ ๋งˆ๋‹ค ๋™์ž‘ํ•˜๋„๋ก ์„ค์ •ํ•ด ์ฃผ์—ˆ์–ด์š”.

 

vim /etc/heartbeat/heartbeat.yml [Heartbeat]


์œ„ ๋‚ด์šฉ์€ tcp๋ฅผ ์ด์šฉํ•˜์—ฌ MariaDB๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ๊ตฌ๋™์ค‘์ธ์ง€ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•œ ๋ถ€๋ถ„์ด์—์š”.

๋งค์ผ 1800์ดˆ ๊ฐ„๊ฒฉ์œผ๋กœ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋„๋ก ์„ค์ •ํ•ด ์ฃผ์—ˆ์–ด์š”.


vim /etc/heartbeat/heartbeat.yml [Heartbeat]


๊ทธ๋ฆฌ๊ณ  ์œ„ ๋‚ด์šฉ์€ http Protocol์„ ํ†ตํ•ด ์„œ๋น„์Šคํ•˜๋Š” ์„œ๋น„์Šค๊ฐ€ ์ž˜ ๋™์ž‘์ค‘์ธ์ง€ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•œ ๋ถ€๋ถ„์ด์—์š”.


heartbeat.config.monitors:
  # Directory + glob pattern to search for configuration files
  path: ${path.config}/monitors.d/*.yml
  # If enabled, heartbeat will periodically check the config.monitors path for changes
  reload.enabled: true
  # How often to check for changes
  reload.period: 5s

# Configure monitors inline
heartbeat.monitors:
- type: icmp
  schedule: '59 * * * * * *'
  hosts:
    - "192.168.0.2"
    - "192.168.0.3"
    - "192.168.0.4"
    - "192.168.20.2"
    - "192.168.20.3"
    - "192.168.20.4"
    - "192.168.20.5"
    - "192.168.20.251"
    - "192.168.20.252"
    - "192.168.20.254"
    - "192.168.30.2"
  id: junyss-icmp-service
  name: Junyss ICMP Service

- type: tcp
  schedule: '@every 1800s'
  hosts:
    - "192.168.20.254:3306"
  mode: any
  id: junyss-tcp-service

- type: http
  # Set enabled to true (or delete the following line) to enable this monitor
  enabled: true
  # ID used to uniquely identify this monitor in Elasticsearch even if the config changes
  id: heartbeat_http_check_ID
  # Human readable display name for this service in Uptime UI and elsewhere
  name: Junyss HTTP Check With heartbeat Monitor
  # List of URLs to query
  urls:
    - "192.168.20.3:80"
    - "192.168.20.253:5601"
    - "192.168.20.254:9200"
  # Configure task schedule
  schedule: '@every 1800s'

 

 

vim /etc/heartbeat/heartbeat.yml [kibana]

 

setup.kibana:

  # Kibana Host
  # Scheme and port can be left out and will be set to the default (http and 5601)
  # In case you specify and additional path, the scheme is required: http://localhost:5601/path
  # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
  host: "192.168.20.253:5601"

 

 

vim /etc/heartbeat/heartbeat.yml [Elasticsearch Output]

 

output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["192.168.20.254:9200"]

  # Protocol - either `http` (default) or `https`.
  protocol: "http"

  # Authentication credentials - either API key or username/password.
  #api_key: "id:api_key"
  username: "elastic"
  password: "password"

 

 

vim /etc/heartbeat/heartbeat.yml [Logging]

๋ฐ˜์‘ํ˜•
logging.level: info
logging.to_files: true
logging.files:
  path: /var/log/heartbeat
  name: heartbeat
  keepfiles: 7
  permissions: 0640

 

์œ„ ๋‚ด์šฉ์€ ๋‹ค๋ฅธ ๋น„ํŠธ์™€ ๋™์ผํ•˜๊ฒŒ ๋ณ€๊ฒฝํ•ด ์ฃผ์—ˆ์–ด์š”.

 

 

heartbeat setup -e -E output.logstash.enabled=false -E output.elasticsearch.hosts=['์—˜๋ผ์Šคํ‹ฑ ์„œ์น˜ IP:9200'] -E setup.kibana.host=ํ‚ค๋ฐ”๋‚˜ IP:5601

 

 

systemctl enable --now heartbeat-elastic


์œ„์™€ ๊ฐ™์ด heartbeat ๋ฐ๋ชฌ์„ ๊ธฐ๋™ ์‹œํ‚ค๊ณ , ์„œ๋น„์Šค์— ๋“ฑ๋กํ•ด ์ฃผ์—ˆ์–ด์š”.

 

 


heartbeat์˜ ๊ฒฝ์šฐ ๋‹ค๋ฅธ beat ์ฒ˜๋Ÿผ Discover์— ์ž๋™์œผ๋กœ ๋“ฑ๋ก๋˜์ง€ ์•Š์•„ ์ง์ ‘ ๋“ฑ๋กํ•ด ์ฃผ์–ด์•ผ ํ•ด์š”.

 

์œ„์™€ ๊ฐ™์ด ์ด๋ฆ„๊ณผ Index pattern์„ ๋“ฑ๋กํ•˜๊ณ , Timestamp field๋ฅผ ์„ ํƒํ•œ ๋’ค
์•„๋ž˜ Save data view to Kibana ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ์ค๋‹ˆ๋‹ค.

 

 

๊ทธ๋Ÿผ ์œ„์™€ ๊ฐ™์ด heartbeat๊ฐ€ ๋งŒ๋“ค์–ด ์ง„๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

 

 

์™ผ์ชฝ Navigator์— Observability์— ๋ณด๋ฉด Uptime Tab์ด ๋งŒ๋“ค์–ด์กŒ์„ ๊ฑฐ์—์š”.



์ด์ œ ์œ„์™€ ๊ฐ™์ด ๋“ฑ๋กํ–ˆ๋˜ ์„œ๋น„์Šค๋“ค์ด ๊ตฌ๋™๋˜๊ณ  ์žˆ๋Š”์ง€๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

 

 

 

 

 

 

        ๐Ÿ“ฆ Winlogbeat

https://www.elastic.co/kr/beats/winlogbeat

 

์ตœ์ดˆ ์œ„ ์‚ฌ์ดํŠธ์—์„œ ์œˆ๋„์šฐ์šฉ beat๋ฅผ ๋‚ด๋ ค ๋ฐ›์•„ ์ค„๊ฒŒ์š”.

 

 

์œ„์™€ ๊ฐ™์ด ๋‚ด๋ ค ๋ฐ›๊ธฐ ํ•ด ์ฃผ์—ˆ์–ด์š”.

 

 

beat ์••์ถ•ํ•ด์ œ

 

์••์ถ•ํ•ด์ œ ๋œ ํŒŒ์ผ์„ C:\ ๋ฐ‘์— ๋„ฃ์–ด์ค๋‹ˆ๋‹ค.

 

 

winlogbeat.yml

 

winlogbeat.yml [Kibana]

 

์ฐธ๊ณ ๋กœ allow_older_version์€ ๋ฒ„์ „์— ๋”ฐ๋ฅธ ํ˜ธํ™˜ ๋ฌธ์ œ ๋ฐœ์ƒ์„ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด ๋„ฃ์–ด์ค€ ๋‚ด์šฉ์ด์—์š”.

 

winlogbeat.yml [Elasticsearch Outputs]


์œ„์˜ ๋ฆฌ๋ˆ…์Šค์˜ ๊ฐ์ข… ๋น„ํŠธ์™€ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ yml ํŒŒ์ผ์„ ์ˆ˜์ •ํ•ด ์ฃผ์—ˆ์–ด์š”.

 

 

 

Power Shell์„ ์œ„์™€ ๊ฐ™์ด ๊ด€๋ฆฌ์ž ๊ถŒํ•œ์œผ๋กœ ์‹คํ–‰ํ•ด ์ค๋‹ˆ๋‹ค.

 

 

 

PowerShell.exe -ExecutionPolicy UnRestricted -File .\install-service-filebeat.ps1

 

.\winlogbeat.exe test config -c .\winlogbeat.yml -e

 

.\winlogbeat.exe setup -e

 

 

Start-Service winlogbeat


์œ„ ๋ช…๋ น์–ด๋กœ beat๋ฅผ ์‹คํ–‰ํ•ด ์ฃผ์—ˆ์–ด์š”.

 

 

 

ํ‚ค๋ฐ”๋‚˜์˜ Discover์— ๊ฐ€๋ณด๋ฉด ์œ„์™€ ๊ฐ™์ด winlogbeat-*๊ฐ€ ์ƒ๊ธด๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.


๊ฒ€์ƒ‰:&nbsp;Winlogbeat Overview


Dashboards์— ์œ„์™€ ๊ฐ™์ด Template์ด ์ƒ๊ธฐ์—ˆ๊ณ , ์œ„์˜ Template์„ ์„ ํƒํ•ด ๋ณผ๊ฒŒ์š”.





์œ„์™€ ๊ฐ™์ด ์œˆ๋„์šฐ๋ฅผ ๋ชจ๋‹ˆํ„ฐ๋ง ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜์—ˆ์–ด์š”.

 

 

 

 

 

 

๋ฐ์ดํ„ฐ ๋ถ„์„ ํ”Œ๋žซํผ ๊ตฌ์ถ•๊ณผ ํ™œ์šฉ : Fluentd Elasticsearch Kibana๋ฅผ ์ด์šฉํ•œ ๋กœ๊ทธ ์ˆ˜์ง‘๊ณผ ์‹œ๊ฐํ™”

COUPANG

www.coupang.com

"์ด ํฌ์ŠคํŒ…์€ ์ฟ ํŒก ํŒŒํŠธ๋„ˆ์Šค ํ™œ๋™์˜ ์ผํ™˜์œผ๋กœ, ์ด์— ๋”ฐ๋ฅธ ์ผ์ •์•ก์˜ ์ˆ˜์ˆ˜๋ฃŒ๋ฅผ ์ œ๊ณต๋ฐ›์Šต๋‹ˆ๋‹ค."

 

 

 

 

 

๐Ÿง ์ฐธ๊ณ  ์ž๋ฃŒ

 

Monitor Linux System Metrics with ELK Stack - kifarunix.com

In this tutorial, you will learn how to monitor Linux system metrics with ELK Stack. ELK Stack, or if you like, Elastic stack can be used to monitor Linux

kifarunix.com

 

 

Elastic ๊ฐ€์ด๋“œ ๋ถ - Elastic ๊ฐ€์ด๋“œ๋ถ

7. ์ธ๋ฑ์Šค ์„ค์ •๊ณผ ๋งคํ•‘ - Settings & Mappings

esbook.kimjmin.net

 

 

Kibana - Elasticsearch ์—ฐ๋™ํ•˜๋ฉด์„œ ๋ฐœ์ƒํ•œ ํŠธ๋Ÿฌ๋ธ” ์ŠˆํŒ…

Google Cloud Platform์—์„œ pub/sub์œผ๋กœ streaming ๋ฐ์ดํ„ฐ ์ˆ˜์ง‘ํ•˜๋Š” ๊ณผ์ • fluentd โ‡ข ELK (ES, Kibana) ์•„ํ‚คํ…์ฒ˜ ์ˆ˜๋ฆฝ ํ›„ ๊ตฌํ˜„ํ•˜๋Š” ๊ณผ์ •์—์„œ ES, Kibana๋ฅผ VM์œ„์— ์„ค์น˜ ๋ฐ ์šด์˜ํ•˜๋Š” ๊ณผ์ •์—์„œ ๋ฐœ์ƒํ•˜๋Š” ํŠธ๋Ÿฌ๋ธ” ์ŠˆํŒ…์—

thewayitwas.tistory.com

 

 

 

 

 

728x90
๋ฐ˜์‘ํ˜•