본문 바로가기
ELK Stack

[Filebeat] Filebeat 7.9 설치 (Ubuntu Linux 18.04 Filebeat 7.9.x 설치)

by 임채훈 2020. 10. 6.

Linux 환경에서 Filebeat 7.9 설치 (Ubuntu 18.04)

 

Filebeat quick start: installation and configuration | Filebeat Reference [7.9] | Elastic

To test your configuration file, change to the directory where the Filebeat binary is installed, and run Filebeat in the foreground with the following options specified: ./filebeat test config -e. Make sure your config files are in the path expected by Fil

www.elastic.co

 

Step

  1. Filebeat 다운로드
  2. 서비스 등록 (systemctl)
  3. 기본 옵션 및 필수 속성 설정
  4. 실행

 

1. Filebeat 다운로드

1. 디렉토리 이동 /usr/local 

cd /usr/local

2. kibana tar.gz 압축버전 다운로드

wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.9.1-linux-x86_64.tar.gz

3. 압축파일 압축 해제

tar -xvzf filebeat-7.9.1-linux-x86_64.tar.gz

4. Symbolic Link 생성 (바로가기)

ln -s filebeat-7.9.1-linux-x86_64 filebeat

5. 디렉토리 파일 목록 조회

ls -alh /usr/local/filebeat

-rw-r--r--  1 root root   41 Oct 29  2019 .build_hash.txt
drwxr-xr-x  2 root root 4.0K Jan 10  2020 certs
drwxr-xr-x  3 root root 4.0K Feb 26  2020 data
-rw-r--r--  1 root root 266K Oct 29  2019 fields.yml
-rwxr-xr-x  1 root root  72M Oct 29  2019 filebeat
-rw-r--r--  1 root root  80K Oct 29  2019 filebeat.reference.yml
-rw-------  1 root root 9.1K Dec 30  2019 filebeat.yml
drwxr-xr-x  3 root root 4.0K Oct 29  2019 kibana
-rw-r--r--  1 root root  14K Oct 29  2019 LICENSE.txt
drwx------  2 root root 4.0K Apr 29 07:00 logs
drwxr-xr-x 36 root root 4.0K Oct 29  2019 module
drwxr-xr-x  2 root root 4.0K Oct 29  2019 modules.d
-rw-r--r--  1 root root 244K Oct 29  2019 NOTICE.txt
-rw-r--r--  1 root root  802 Oct 29  2019 README.md

 

2. 서비스 등록 (systemctl)

  • /lib/systemd/system/filebeat.service 편집
vi /lib/systemd/system/filebeat.service

[Unit]
Description=Filebeat sends log files to Logstash or directly to Elasticsearch.
Documentation=https://www.elastic.co/products/beats/filebeat
Wants=network-online.target
After=network-online.target

[Service]
ExecStart=/usr/local/filebeat/filebeat -c /usr/local/filebeat/filebeat.yml -path.data /usr/local/filebeat/data
Restart=always

[Install]
WantedBy=multi-user.target

1. service 파일 수정사항 적용

systemctl daemon-reload

2. 부팅 시 kibana 자동 실행 활성화

systemctl enable filebeat

 

3. 기본 옵션 및 필수 속성 설정

  • /usr/local/filebeat/config/filebeat.yml 편집
filebeat.inputs:
- type: log
  enabled: true
  paths:
    - ~/logs/*.log
  • Logstash로 보낼 경우
output.logstash:
  hosts: ["192.168.0.10:5044"]
  • Kafka로 보낼 경우
output.kafka:
  hosts: ["localhost:9092"]
  topic: '%{[fields.topic]}'
  partition.round_robin:
    reachable_only: false
  required_acks: 1
  compression: gzip
  max_massage_bytes: 1000000

 

4. 실행

systemctl start filebeat

댓글