2025년 12월 6일 토요일

Kibana Alert - 2nd

로그스태시도 대안이 될 수 있다. 원하는 조건 입력이메일로 출력하는 방식.
input {
  elasticsearch {
    hosts => "https://192.168.56.1:9200"
    index => "winevent"
    user => "elastic"
    password => "******"
    ssl_certificate_authorities => "D:/ELK/v9/elasticsearch-9.2.0/config/certs/http_ca.crt"
    schedule => "* * * * *"
    query => '{
    "query": {
        "bool": {
          "must": [
            {
              "match": {
                "winlog.event_id": "4624"
              }   
            },
            {
              "match": {
                "winlog.event_data.TargetUserName": "administrator"
              }
            },
            {
              "range": {
                "@timestamp": {
                  "gte": "now-1m",
                  "lte": "now"
                }
              }  
            }
          ]    
        }
      }    
    }'
  }
}
 
output {
  email {
    address => "smtp.gmail.com"
    port => 587
    username => "mhkang589@gmail.com"
    password => "app password"
    to => "mhkang589@gmail.com"
    use_tls => true
    subject => "logstash alert"
    body => "%{[winlog][event_data][TargetUserName]} login"
  }
}

참고로 스플렁크는 서버 설정 > 이메일 설정 후,


원하는 조건 검색 기반 경보 생성.


이메일 트리거 작업 등록.


관련 글

댓글 없음:

댓글 쓰기

크리에이티브 커먼즈 라이선스