패키지 제거 명령어
sudo apt-get purge [패키지 이름]
Bash
복사
1. Elastic Search 설치
ELK Stack 구성요소는 기본적으로 Ubuntu의 apt 저장소에서 사용 불가
Elastic의 패키지 소스 목록을 수동으로 추가해야함
1.1 GPG키 다운로드
curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elastic.gpg
Bash
복사
Elasticsearch의 GPG 키를 다운로드하여 elastic.gpg라는 파일로 저장
해당 키는 패키지의 신뢰성을 검증하는 데 사용
GPG?
GNU Privacy Guard Key
소프트웨어 패키지의 신뢰성을 검증하기 위해 사용되는 암호화 키
소프트웨어를 다운로드할 때, 이 키를 통해 해당 소프트웨어가 공식 출처에서 배포된 것인지 확인할 수 있다.
1.2 Elasticsearch 패키지 저장소 추가
echo "deb [signed-by=/usr/share/keyrings/elastic.gpg] https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
Bash
복사
1.3 필수 패키지 설지
sudo apt-get install apt-transport-https
Bash
복사
1.3 업데이트 및 설치 진행
sudo apt update
sudo apt install elasticsearch=7.16.2
Bash
복사
1.4 구성 파일 수정
sudo vi /etc/elasticsearch/elasticsearch.yml
Bash
복사
•
23번 주석 해제
•
56번 주석 해제 및 수정 : 0.0.0.0
•
70번 주석 해제 및 수정
•
74 번 주석 해제 및 수정
1.5 서비스 시작 및 활성화
sudo systemctl start elasticsearch
sudo systemctl enable elasticsearch
Bash
복사
1.6 테스트
curl -X GET "localhost:9200"
Bash
복사
설치에 문제가 없다면 아래와 같이 출력됨
2. Kibana 설치
2.1 패키지 설치
sudo apt install kibana=7.16.2
Bash
복사
파일 수정
sudo vi /etc/kibana/kibana.yml
Bash
복사
2.2 서비스 활성화 및 시작
sudo systemctl enable kibana
sudo systemctl start kibana
Bash
복사
4. Filebeat 설치
4.1 Filebeat 설치
sudo apt install filebeat=7.16.2
Bash
복사
4.2 Filebeat 설정
sudo vi /etc/filebeat/filebeat.yml
Bash
복사
아래와 같이 수정
filebeat.inputs:
- type: filestream
id: my-filestream-id
enabled: true
paths:
- /var/log/*.log
filebeat.config.modules:
path: ${path.config}/modules.d/*.yml
reload.enabled: false
setup.template.settings:
index.number_of_shards: 1
setup.kibana:
host: "https://<kibana_ip>:5601"
ssl.verification_mode: none
output.elasticsearch:
hosts: ["https://<elasticsearch_node_ip>:9200"]
ssl.verification_mode: none
username: "elastic"
password: "insert_the_pass_you_set"
processors:
- add_host_metadata:
when.not.contains.tags: forwarded
- add_cloud_metadata: ~
- add_docker_metadata: ~
- add_kubernetes_metadata: ~
seccomp:
default_action: allow
Bash
복사
아래 내용 추가가 중요함
안 하면 glibc 오류 발생
seccomp:
default_action: allow
Bash
복사
설정 적용
filebeat setup -e
Bash
복사
시작
sudo systemctl enable filebeat
sudo systemctl start filebeat
Bash
복사
연동확인
윈도우
winlogbeat설치
winlogbeat.yml 수정
# =================================== Kibana ===================================
# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
# This requires a Kibana endpoint configuration.
setup.kibana:
# Kibana Host
# Scheme and port can be left out and will be set to the default (http and 5601)
# In case you specify and additional path, the scheme is required: http://localhost:5601/path
# IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
host: "https://<ip_of_kibana_host>:5601"
ssl.verification_mode: none
# ---------------------------- Elasticsearch Output ----------------------------
output.elasticsearch:
# Array of hosts to connect to.
hosts: ["https://<ip_of_elasticsearch_host>:9200"]
ssl.verification_mode: none
# Protocol - either `http` (default) or `https`.
#protocol: "https"
# Pipeline to route events to security, sysmon, or powershell pipelines.
pipeline: "winlogbeat-%{[agent.version]}-routing"
Bash
복사
설정 적용 및 실행
설정 테스트
cmd 관리자 권한으로 실행, winlogbeat 가 있는 곳으로 이동
winlogbeat.exe test config
Bash
복사
설정 적용
winlogbeat.exe setup
Bash
복사
실행
winlogbeat.exe
Bash
복사
서비스로 등록
PowerShell.exe -ExecutionPolicy UnRestricted -File .\install-
service-winlogbeat.ps1
Bash
복사