[Filebeat] 7.10.2 설치

v K_Y v·2023년 6월 16일
0

ELK

목록 보기
4/4
post-thumbnail

binary 파일로 on-premise 환경에서 filebeat 구축법을 공유합니다.
docker는 ➡️ (docker_elk)

Filebeat란?

  • Elastic Stack의 구성 요소 중 하나로, 로그 파일을 수집하고 전송하는 역할을 담당하는 경량 데이터 수집기입니다.
  • Filebeat는 로그 파일, 이벤트 파일, 시스템 로그 등 다양한 유형의 로그 데이터를 모니터링하고, 이를 실시간으로 Elastic Stack의 다른 구성 요소로 전송합니다.

Filebeat 설치


설정파일

  • elasticsearch log를 수집할 계획이므로 filebeat의 Elasticsearch module 을 이용해 log 파싱합니다.

filebeat.yml

filebeat.config.modules:
  path: ${MODULE_PATH}
  reload.enabled: false

setup.kibana:
  host: ${KIBANA_HOST}
  protocol: "http"
  dashboards.enabled: true

output.elasticsearch:
  hosts: [${ES_HOST}]

module yml

  • 사용하려는 모듈 enable 후 해당 모듈 yml 작성합니다.
  • enable 후 ${FILEBEAT_HOME}/modules.d 폴더 내 해당 모듈 yml이 생성됩니다.
  • elasticsearch.yml
# Module: elasticsearch
# Docs: https://www.elastic.co/guide/en/beats/filebeat/7.10/filebeat-module-elasticsearch.html

- module: elasticsearch
  # Server log
  server:
    enabled: true

    # Set custom paths for the log files. If left empty,
    # Filebeat will choose the paths depending on your OS.
    var.paths:
      - ${ES_LOG_PATH}/*_server.json

  audit:
    enabled: true
    # Set custom paths for the log files. If left empty,
    # Filebeat will choose the paths depending on your OS.
    var.paths:
      - ${ES_LOG_PATH}/*_audit.json

  slowlog:
    enabled: true
    # Set custom paths for the log files. If left empty,
    # Filebeat will choose the paths depending on your OS.
    var.paths:
      - ${ES_LOG_PATH}/*_index_search_slowlog.json
      - ${ES_LOG_PATH}/*_index_indexing_slowlog.json

  deprecation:
    enabled: true
    # Set custom paths for the log files. If left empty,
    # Filebeat will choose the paths depending on your OS.
    var.paths:
      - ${ES_LOG_PATH}/*_deprecation.json

Filebeat 서비스 활성화

# 서비스 활성화
systemctl enable filebeat.service

# 서비스 reload
systemctl daemon-reload
  • /lib/systemd/system/filebeat.service를 작성합니다.
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=${FILEBEAT_HOME}/filebeat -e -c ${FILEBEAT_HOME}/filebeat.yml
Restart=always

[Install]
WantedBy=multi-user.target
  • service로 Filebeat를 실행합니다.
systemctl start filebeat
profile
📌 기억하기 위해 남기는 기록들

0개의 댓글