【发布时间】:2020-11-04 20:25:29
【问题描述】:
我正在使用 Opendistro 创建警报并调用自定义 webhook 来发送警报。我希望 Opendistro 在消息中发送查询结果。唯一的问题是结果的格式不是 json,而是接近的格式。
例如,如果消息模板(Mustache)如下
{{{ctx.results.0}}}
我的 webhook 可能会收到类似的内容
{_shards={total=30, failed=0, successful=30, skipped=0}, hits={hits=[], total=3, max_score=0.0}, took=16, timed_out=false, aggregations={aggregation={doc_count_error_upper_bound=0, sum_other_doc_count=0, buckets=[{doc_count=3, key=1.1.1.1}]}}}
这是查询结果,但没有格式化为json。我想知道是否有办法在 mustache 模板中将复杂变量输出为 json,或者是否有办法解析上述格式。或者也许在上下文中还有另一个变量已经被字符串化了?
我在 Opendistro 论坛上发现了另一个 post,它暴露了同样的问题。
【问题讨论】:
标签: kibana mustache elasticsearch-opendistro