30 秒間隔ごとに、イベントに表示されるカウント数を確認する必要があります。カウントが 5 を超える場合は、メールをトリガーする必要があります。
以下のコードを使用していますが、メールがトリガーされませんでした。
(let [userindex1 (default :ttl 300 (update-index (index)))]
(streams
prn
userindex1))
(streams
(where (and (service "system_log")
(not (expired? event)))
; fixed-time-window sends a vector of events out every 30 seconds
(fixed-time-window
30
; smap passes those events into a function
(smap
(fn [events]
;Calculate the no of count of events for failure
(let [numberofFailure (count (filter #(="IE" (:description %)) events))]
{:status "login failures"
:metric numberofFailure
:totalFail (boolean(numberofFailure > 5))}
(streams
prn
numberofFailure))))
;check if the variable status is true if condition satisfied then trigger an email
(let [email (mailer {:host "smtp.gmail.com"
:port 25
:user "aaaaa"
:pass "bbbbb"
:auth "true"
:subject (fn [events]
(clojure.string/join ", "
(map :service events)))
:from "abc@gmail.com"})]
(streams
(where (and (:status "login failures")
(:totalFail true))
(email "123@gmail.com")))))))
どこが間違っていますか?