우분투 설치 · 5 min read · Oct 27, 2025
우분투에 FileBeat 설치하는 방법

Elastic Stack은 Elasticsearch, Logstash, Kibana 및 Beats의 네 가지 주요 구성 요소의 조합입니다. Filebeat는 이벤트 로그 데이터를 수집하고, 전달하며, Elasticsearch 또는 Logstash에 중앙 집중화하여 인덱싱하는 이 가족의 가장 유명한 구성원 중 하나입니다. Filebeat에는 Apache, Nginx, System, MySQL, auditd 등 많은 모듈이 있어 일반 로그 형식의 시각화를 단일 명령으로 단순화합니다.
이 튜토리얼에서는 우분투 18.04에서 이벤트 로그 및 SSH 인증 이벤트를 Logstash로 전달하기 위해 Filebeat를 설치하고 구성하는 방법을 보여줍니다.
전제 조건
- Elasticsearch, Kibana 및 Logstash가 설치되고 구성된 우분투 18.04 서버.
- 서버에 루트 비밀번호가 구성되어 있어야 합니다.
시작하기
시작하기 전에 시스템을 최신 버전으로 업데이트하십시오. 다음 명령을 실행하여 수행할 수 있습니다:
apt-get update -y
apt-get upgrade -y시스템이 업데이트되면 변경 사항을 적용하기 위해 재부팅하십시오.
Filebeat 설치
기본적으로 Filebeat는 우분투 18.04 기본 저장소에 없습니다. 따라서 시스템에 Elastic Stack 7 APT 저장소를 추가해야 합니다.
먼저, 다음 명령으로 필요한 패키지를 설치하십시오:
apt-get install apt-transport-https -y다음으로, 다음 명령으로 Elastic Stack 키를 다운로드하고 추가하십시오:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -다음으로, 다음 명령으로 Elastic Stack 7 Apt 저장소를 추가하십시오:
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | tee /etc/apt/sources.list.d/elastic-7.x.list다음으로, 저장소를 업데이트하고 다음 명령으로 Filebeat를 설치하십시오:
apt-get update -y
apt-get install filebeat -y설치가 완료되면 다음 단계로 진행할 수 있습니다.
Filebeat 구성
기본적으로 Filebeat는 이벤트 데이터를 Elasticsearch로 전송하도록 구성되어 있습니다. 여기에서는 Filebeat를 Logstash로 이벤트 데이터를 전송하도록 구성할 것입니다. /etc/filebeat/filebeat.yml 파일을 편집하여 수행할 수 있습니다:
nano /etc/filebeat/filebeat.ymlElasticsearch 출력을 주석 처리하고 Logstash 출력을 주석 해제하십시오:
#-------------------------- Elasticsearch output ------------------------------
# output.elasticsearch:
# Array of hosts to connect to.
# hosts: ["localhost:9200"]
#----------------------------- Logstash output --------------------------------
output.logstash:
# The Logstash hosts
hosts: ["localhost:5044"]
작업이 완료되면 다음 단계로 진행할 수 있습니다.
Filebeat 시스템 모듈 활성화
기본적으로 Filebeat에는 많은 모듈이 포함되어 있습니다. 다음 명령으로 모든 모듈을 나열할 수 있습니다:
filebeat modules list다음과 같은 출력을 볼 수 있어야 합니다:
Enabled:
Disabled:
apache
audited
aws
cef
cisco
coredns
elasticsearch
envoyproxy
googlecloud
haproxy
ibmmq
icinga
iis
iptables
kafka
kibana
logstash
mongodb
mssql
mysql
nats
netflow
nginx
osquery
panw
postgresql
rabbitmq
redis
santa
suricata
system
traefik
zeek
기본적으로 모든 모듈이 비활성화되어 있습니다. 따라서 시스템 로그 서비스에서 생성된 로그를 수집하고 구문 분석하기 위해 시스템 모듈을 활성화해야 합니다. 다음 명령으로 시스템 모듈을 활성화할 수 있습니다:
filebeat modules enable system다음으로, 다음 명령으로 시스템 모듈을 확인할 수 있습니다:
filebeat modules list이제 시스템 모듈이 활성화되었음을 확인할 수 있어야 합니다:
Enabled:
system
다음으로, 시스템 모듈을 구성하여 인증 로그만 읽도록 해야 합니다. /etc/filebeat/modules.d/system.yml 파일을 편집하여 수행할 수 있습니다:
nano /etc/filebeat/modules.d/system.yml다음 줄을 변경하십시오:
- module: system
# Syslog
syslog:
enabled: false
...
# Authorization logs
auth:
enabled: true
# Set custom paths for the log files. If left empty,
# Filebeat will choose the paths depending on your OS.
var.paths: ["/var/log/auth.log"]
작업이 완료되면 파일을 저장하고 닫으십시오.
Elasticsearch에 인덱스 템플릿 로드
다음으로, Elasticsearch에 템플릿을 수동으로 로드해야 합니다. 다음 명령으로 수행할 수 있습니다:
filebeat setup --index-management -E output.logstash.enabled=false -E 'output.elasticsearch.hosts=["localhost:9200"]'다음과 같은 출력을 볼 수 있어야 합니다:
Index setup finished.
다음으로, 인덱스 템플릿을 생성하고 다음 명령으로 Elastic Stack 서버에 템플릿을 설치하십시오:
filebeat export template > filebeat.template.json
curl -XPUT -H 'Content-Type: application/json' http://localhost:9200/_template/filebeat-7.0.1 --data-binary @filebeat.template.json마지막으로, 다음 명령으로 Filebeat 서비스를 시작하고 시스템 재부팅 후 시작되도록 활성화하십시오:
systemctl start filebeat
systemctl enable filebeat다음 명령으로 Filebeat의 상태를 확인할 수 있습니다:
systemctl status filebeat다음과 같은 출력을 볼 수 있어야 합니다:
? filebeat.service - Filebeat sends log files to Logstash or directly to Elasticsearch.
Loaded: loaded (/lib/systemd/system/filebeat.service; disabled; vendor preset: enabled)
Active: active (running) since Tue 2019-11-26 06:45:18 UTC; 14s ago
Docs: https://www.elastic.co/products/beats/filebeat
Main PID: 13059 (filebeat)
Tasks: 28 (limit: 463975)
CGroup: /system.slice/filebeat.service
??13059 /usr/share/filebeat/bin/filebeat -e -c /etc/filebeat/filebeat.yml -path.home /usr/share/filebeat -path.config /etc/filebeat
Nov 26 06:45:18 ubuntu filebeat[13059]: 2019-11-26T06:45:18.528Z INFO log/harvester.go:251 Harvester started for file: /va
Nov 26 06:45:18 ubuntu filebeat[13059]: 2019-11-26T06:45:18.528Z INFO log/harvester.go:251 Harvester started for file: /va
Nov 26 06:45:18 ubuntu filebeat[13059]: 2019-11-26T06:45:18.529Z INFO log/harvester.go:251 Harvester started for file: /va
Nov 26 06:45:18 ubuntu filebeat[13059]: 2019-11-26T06:45:18.529Z INFO log/harvester.go:251 Harvester started for file: /va
Nov 26 06:45:18 ubuntu filebeat[13059]: 2019-11-26T06:45:18.530Z INFO log/harvester.go:251 Harvester started for file: /va
Nov 26 06:45:18 ubuntu filebeat[13059]: 2019-11-26T06:45:18.530Z INFO log/harvester.go:251 Harvester started for file: /va
Nov 26 06:45:21 ubuntu filebeat[13059]: 2019-11-26T06:45:21.485Z INFO add_cloud_metadata/add_cloud_metadata.go:87 add_clou
Nov 26 06:45:21 ubuntu filebeat[13059]: 2019-11-26T06:45:21.486Z INFO log/harvester.go:251 Harvester started for file: /va
Nov 26 06:45:22 ubuntu filebeat[13059]: 2019-11-26T06:45:22.485Z INFO pipeline/output.go:95 Connecting to backoff(async(tc
Nov 26 06:45:22 ubuntu filebeat[13059]: 2019-11-26T06:45:22.487Z INFO pipeline/output.go:105 Connection to backoff(async(t
Elasticsearch 데이터 수신 테스트
이제 다음 명령으로 Elasticsearch가 데이터를 수신하고 있는지 확인하십시오:
curl -X GET localhost:9200/_cat/indices?v다음과 같은 출력을 볼 수 있어야 합니다:
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open .kibana_task_manager_1 fpHT_GhXT3i_w_0Ob1bmrA 1 0 2 0 46.1kb 46.1kb
yellow open ssh_auth-2019.11 mtyIxhUFTp65WqVoriFvGA 1 1 15154 0 5.7mb 5.7mb
yellow open filebeat-7.4.2-2019.11.26-000001 MXSpQH4MSZywzA5cEMk0ww 1 1 0 0 283b 283b
green open .apm-agent-configuration Ft_kn1XXR16twRhcZE4xdQ 1 0 0 0 283b 283b
green open .kibana_1 79FslznfTw6LfTLc60vAqA 1 0 8 0 31.9kb 31.9kb
다음 명령으로 ssh_auth-2019.05 인덱스를 확인할 수도 있습니다:
curl -X GET localhost:9200/ssh_auth-*/_search?pretty다음과 같은 출력을 볼 수 있어야 합니다:
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 10000,
"relation" : "gte"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "ssh_auth-2019.11",
"_type" : "_doc",
"_id" : "g7OXpm4Bi50dVWRYAyK4",
"_score" : 1.0,
"_source" : {
"log" : {
"offset" : 479086,
"file" : {
"path" : "/var/log/elasticsearch/gc.log"
}
},
"event" : {
"timezone" : "+00:00",
"dataset" : "elasticsearch.server",
"module" : "elasticsearch"
},
Kibana에 인덱스 추가
이제 Kibana 대시보드에 로그인하고 인덱스 패턴을 클릭하십시오. 다음 페이지가 표시됩니다:

이제 인덱스 패턴 생성을 클릭하십시오. 다음 페이지가 표시됩니다:

ssh_auth- 인덱스를 추가하고 *다음 단계 버튼을 클릭하십시오. 다음 페이지가 표시됩니다:

이제 @timestamp를 선택하고 인덱스 패턴 생성 버튼을 클릭하십시오. 다음 페이지가 표시됩니다:

이제 왼쪽 패널에서 발견 탭을 클릭하십시오. 다음 화면에서 데이터를 볼 수 있어야 합니다:

축하합니다! Filebeat를 성공적으로 설치하고 구성하여 이벤트 데이터를 Logstash로 전송했습니다. 이제 모든 데이터를 수신한 후 Kibana 대시보드를 생성할 수 있습니다.
새 게시물을 받은 편지함에서 받기
스팸은 없습니다. 언제든지 구독 해지 가능합니다.