2
리만/클루저의 주요 개념을 이해하지 못하고 있습니다. 형식 : "aaa:1234.bbbb.cccc.ddddd"
인 이벤트의 field : service를 구문 분석하고 "with"기능을 사용하여 이벤트에 새 필드 pid를 추가하려고합니다. 당신이 where
의 본문에 service
를 사용할 수없는 이유입니다 (where* (fn [event] (let [service (:service event)] ,,,)))
의 where
매크로에 의해 단지 문법 설탕을 내가 (where (service ,,,))
생각리먼 이벤트에 새 필드 삽입
...
(let [index (default :ttl 300 (update-index (index)))]
; Inbound events will be passed to these streams:
(streams
index
(where (service #"(\w+):(\d+)\.(\w+)\.(\w+)\.(\w+)")
(with :pid (str/replace service #"(\w+):(\d+)\.(\w+)\.(\w+)\.(\w+)" "$2")
)
)
...
user=> (riemann.bin/reload!)
#error {
:cause "Unable to resolve symbol: service in this context"
:via
[{:type clojure.lang.Compiler$CompilerException
:message "java.lang.RuntimeException: Unable to resolve symbol: service in this context, compiling:(/etc/riemann/riemann.config:73:19)"
예, 감사합니다, 그것은 작동 : – user8173324
user8173324 @ 멋진! 사람들이이 질문을 해결할 수 있도록 답변을 수락하십시오 :) –