1. ELK 설치 및 curl 명령어 설치가 됐다는 가정하에 진행한다.
https://pinggoopark.tistory.com/111
[Linux] 우분투에 ELK 설치하고 실행해보기
1. 설치 가능한 패키지 리스트 업데이트 apt update 2. 설치한 패키지들을 최신 버전으로 업그레이드 apt upgrade -y 3. openjdk 8버전 설치하기 apt-get install openjdk-8-jdk -y 4. java 환경설정 vi /etc/p..
pinggoopark.tistory.com
https://pinggoopark.tistory.com/115
[Linux] 우분투에 curl 명령어 설치하기
1. curl 설치 apt install curl 2. 설치 후 curl 명령어 테스트 이전 포스트에서 elasticsearch를 설치 후 실행돼 있는 상태라고 가정한다 curl localhost:9200
pinggoopark.tistory.com
2. elasticsearch logstash kibana 실행
systemctl start elasticsearch
systemctl start kibana
systemctl start logstash
3. elasticsearch logstash kibana 실행 상태 확인
systemctl status elasticsearch
systemctl status kibana
systemctl status logstash
4. 샘플 파일 만들기
cd /etc/logstash
ls
mkdir test
ls
cd test
ls
pwd
vi sample.csv
다음과 같이 내용 넣고 저장
1
2
3
4
5
6
7
8
9
10
5. 현재 elasticsearch의 인덱스 확인
curl localhost:9200/_cat/indices?v
6. logstash의 conf 파일 만들기
ls
pwd
cd ..
ls
mkdir myconf
ls
cd myconf
vi first.conf
다음 내용을 적어보자
방금 만든 sample.csv 파일을 elasticsearch로 데이터를 넣겠다는 의미의 컨프파일
input
{
file
{
path => "/etc/logstash/test/sample.csv"
start_position => "beginning"
sincedb_path => "/dev/null"
codec => "json"
}
}
filter
{
}
output
{
elasticsearch
{
hosts => "localhost:9200"
index => "first_index"
}
}
파일이 잘 저장됐는지 확인하고, 파이프라인을 수정하자
로그스태시의 pipelines.yml 파일을 수정해보자
ls
cd ..
ls
vi pipelines.yml
방금 만든 conf파일을 적용시켜보자
다음과 같이 수정하고 저장한다.
- pipeline.id: main
path.config: "/etc/logstash/myconf/first.conf"
7. 동작 확인하기
마지막으로 현재 엘라스틱서치의 인덱스를 확인해보자
curl localhost:9200/_cat/indices?v
로그스태시를 재실행 시킨다
systemctl restart logstash
로그스태시가 실행됐더라도, 로그를 확인해보면 정상동작하기까지 시간이 좀 걸리는데
넉넉 잡아서 1분 뒤에 다시 curl 명령어로 elasticsearch의 인덱스를 확인해보자
curl localhost:9200/_cat/indices?v
내가 만든 first_index 라는 이름을 가진 인덱스가 잘 생성된 것을 볼 수 있다!!!!!!!!!!!
'Operating System > Linux' 카테고리의 다른 글
[Linux] 우분투의 apt update 와 apt upgrade 의 차이 (0) | 2021.08.28 |
---|---|
[WSL] 윈도우에 WSL2에서 nvidia-docker GPU, CUDA 사용하기 (0) | 2021.08.28 |
[Linux] 우분투에 curl 명령어 설치하기 (0) | 2021.08.27 |
[Linux] 우분투에 설치한 kibana 버전 확인하기 (0) | 2021.08.27 |
[Linux] 우분투에 설치한 logstash 버전 확인하기 (0) | 2021.08.27 |