2017-10-19 4 views
1

ElastAlert 프레임 워크를 사용하여 flatline 경고 유형을 생성합니다.ElastAlert 플랫 라인 결과를 찾을 수 없음

정확히 같은 구문으로 Kibana UI에서 쿼리를 사용할 때 ElastAlert가 결과를 반환하지 않습니다.

여기

name: Test Flatline 
type: flatline 
run_every: 
    seconds: 15 
relalert: 
    minutes: 0 
es_host: localhost 
es_port: 9200 
threshold: 1 
timeframe: 
    minutes: 5 
index: my-index-* 
filter: 
- query: 
    query_string: 
     query: "_type:metric" # this returns results in both kibana and elastalert 
     #query: "_type:metric AND _exists_:My\ Field\ With\ Spaces.value" # this returns results in kibana but not in elastalert 

timestamp_type: unix_ms 
alert: 
    - command 
command: ["my-bash-script.sh"] 

그래서 나는 쿼리 함께 놀러 시도하고 난 그냥 다음 _type:metric을 지정하면 키바의 검색 결과는 ElastAlert에 일치하는 것 내 elastalert-규칙 file.xml입니다.

그러나 두 번째 쿼리에서 _exists_ lucene 구문을 사용하여 쿼리를 사용하려고 시도 할 때 ElastAlert는 아무 것도 반환하지 않습니다. 반면 Kibana는 구문에 문제가없는 것 같습니다.

아이디어가 있으십니까?

답변

0

나는 그것을 얻었다. .. 단지 대답을 게시하는 것을 잊었다.

query: "_type:metric AND _exists_:My\\ Field\\ With\\ Spaces.value" 

을 또한, 특별한 경우에 당신은 당신이 필요로하는 Ansible (YAML) 구성을 사용하는 경우 : 문제의 라인은 다음과 같이 할 수 있도록 백 슬래시를 이스케이프 할 필요가 공백 필드의 분명히

각 백 슬래시를 이스케이프하기 위해 백 슬래시를 추가합니다.

그래서 YAML 파일의 항목은 다음과 같이 보일 것입니다 :

query: "My\\\\ field\\\\ With\\\\ Spaces.value"