Filebeat 는 ELK 스택이 설치된 서버와 별도로 로그를 생성하는 서버에서 설치
GPG 키 다운로드
$ rpm —import https://artifacts.elastic.co/GPG-KEY-elasticsearch
RPM repository 에서 install (setting)
$ vim /etc/yum.repos.d/elastic.repo
[elastic-8.x]
name=Elastic repository for 8.x packages
baseurl=https://artifacts.elastic.co/packages/8.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
위 내용을 /etc/yum.repos.d/elastic.repo 에 저장
설치
$ yum install filebeat
설정
/etc/filebeat/filebeat.yml
filebeat.inputs:
- type: log
- id: kosmos-log
- enabled: true
- paths:
- /root/.pm2/logs/*.log
#output.elasticsearch: <— 주석처리
#hosts: [“localhost:9200”]
output.logstash
hosts: [“xxx.xxx.xxx.xxx:5044”] # 연결 가능한 상황에서는 private ip
ec2 인스턴스들의 보안 규칙 업데이트
시작
$ service filebeat start