Elastic Stack을 통한 로그모니터링을 구성하고, 임계치 알람에 대한 부분은 Kibana를 이용하려했으나,
현재 이용중인 모니터링은 전부 telegram을 통해 알람을 받고있기에 별도 플러그인이 제공되지않는것으로 보여,
webhook을 이용한 방법으로 진행해야한다. 여러가지 서칭 중
사내 개발자에게 추천받은 오픈소스인 ElastAlert으로 임계치 알람에 대한 부분을 진행하려고한다.
Getting Started — ElastAlert 2 0.0.1 documentation
ElastAlert 2 can easily be run as a Docker container or directly on your machine as a Python package. If you are not interested in modifying the internals of ElastAlert 2, the Docker container is recommended for ease of use. As a Kubernetes deployment The
elastalert2.readthedocs.io
위 내용을 참조하여 설치를 진행했다.
설치시 문서에 나와있는것처럼 파이썬 3.12 이상 설치하여야 정상적으로 동작한다.
아래는 샘플로 auditbeat index에서 파일 변조를 감지하여 telegram을 통해 Alert을 발송하는 룰이다.
es_host: 127.0.0.1
es_port: 9200
name: ElastAlert FileIntegrity rule
type: any
index: auditbeat-*
num_events: 1
timeframe:
minutes: 30
filter:
- term:
event.module: "file_integrity"
alert:
- "telegram"
telegram_bot_token: ""
telegram_room_id: ""
alert_subject_args : [ "event.module" ]
alert_subject : "{0} Alert"
alert_text_args: ["@timestamp", "host.name","host.ip","file.path","event.type","event.action"]
alert_text_type: alert_text_only
alert_text : |
time : {0}
Host : {1}({2})
FilePath : {3}
Messages : ⚠️ {3} 파일이 변조({4}) 되었습니다. 확인이 필요합니다({5}).⚠️
'Project > ElasticStack' 카테고리의 다른 글
beat-rsyslog 연동 이슈 (1) | 2024.09.26 |
---|---|
ElastAlert2 Alert UTC 타임존 문제 해결 (0) | 2024.09.25 |
로그 모니터링 시스템 구축 도전기 #2 로그 파싱룰 잡기(Grok) (0) | 2024.02.23 |
로그 모니터링 시스템 구축 도전기 #1 index? query? documents? (0) | 2024.02.02 |
로그 모니터링 시스템 구축 도전기#0 (0) | 2023.02.09 |