1. ELK 란?
ELK 는 Elasticsearch + logstash + kibana 의 앞글자만 딴 단어다.
- Elasticsearch : 분석 및 저장
- logstash : 수집할 로그를 선정하고, 지정된 서버(Elasticsearch) 에 인덱싱하여 전송함.
- kibana : 데이터를 시각적으로 탐색하고 분석할 수 있음.
2. ELK 설치
Elasticsearch, logstash, kibana 3개의 한 폴더에 받는게 키포인트다. 아~주 간단하다 ㅋ
1. Elasticsearch
https://www.elastic.co/kr/downloads/elasticsearch
Download Elasticsearch
Download Elasticsearch or the complete Elastic Stack (formerly ELK stack) for free and start searching and analyzing in minutes with Elastic.
www.elastic.co
window 를 클릭하여 설치를 진행한다.
폴더 하나를 생성해서 압축을 풀어준다.
압축을 풀어준 경로에 bin 폴더가 존재한다.
elasticsearch.bat 를 실행해보자.
실행 후, http://localhost:9200/ 로 접속해보자.
정상적으로 실행되는 것을 확인할 수 있다.
2. kibana 설치
https://www.elastic.co/kr/downloads/kibana
Download Kibana Free | Get Started Now
Download Kibana or the complete Elastic Stack (formerly ELK stack) for free and start visualizing, analyzing, and exploring your data with Elastic in minutes.
www.elastic.co
kibana-8.10.4\bin\kibana.bat 실행
웹페이지에 localhost:5601 을 입력하여 사이트에 접속할 수 있다.
접속하면 토큰을 입력해야하는데... 그거는 elasticsearch 쪽에서 토큰을 얻어와야한다.
elasticsearch-create-enrollment-token -s kibana
cmd 창을 통해서 명령어를 입력한다. elasticsearch-create-enrollment-token 은
ex) C:\Users\Desktop\elk\elasticsearch-8.10.4\bin\elasticsearch-create-enrollment-token -s kibana
빨간색 부분은 설치한 폴더의 위치로 바꿔주면 된다.
다른 사람들은 어땠는지 모르겠지만.. 일단.. id 랑 비밀번호가 뭔지 몰라서 로그인을 할 수 없었다.
elasticsearch-reset-password -i -u elastic
토큰을 찾을 때 처럼 위의 명령어를 입력한다.
비밀번호를 설정하면 로그인이 가능하다.
id : elastic
pass : 설정한 비밀번호
3. logstash 설치
https://www.elastic.co/kr/downloads/logstash
Download Logstash Free | Get Started Now
Download Logstash or the complete Elastic Stack (formerly ELK stack) for free and start collecting, searching, and analyzing your data with Elastic in minutes.
www.elastic.co
logstash 는 bat 파일만 실행해서는 동작하지 않는다.
log 를 처리할 .conf 파일을 생성해서 동작 명령을 해야한다.
cd C:\Users\\Desktop\elk\logstash-8.10.4\bin
logstash -f test.conf
정리하면, logstash 를 통해 elasticsearch 에 로그를 전달하고, kibana 를 통해 저장된 데이터를 시각화할 수 있는 것이다.
다음 글에서는 3개를 이용해서 실제 로그 수집 후 검색하는 기능까지 추가하도록 하겠다.
'ELK' 카테고리의 다른 글
[ELK] Kibana 외부망에서 접근하기 (0) | 2023.10.30 |
---|---|
[ELK] 파이썬 API 서버, Logstash, Kibana, Elasticsearch 연동 (1) | 2023.10.28 |
[ELK] 파이썬 로그 API 서버 구현 (1) | 2023.10.22 |