写入文件

Kapacitor Write to file

.勾选脚本:

stream
    |from()
        .measurement('httpjson_example')
    |alert()
        .crit(lambda: "temperature" <  70)
        // Whenever we get an alert write it to a file.
        .message('test')
        .log('/tmp/test.log')

输出test.log:

..."message":"test","CRITICAL","data":{"series":[{"name":"httpjson_example","tags":{"host":"influxdata","server":"http://...:8080/readings"},"columns":["time","dewPoint","heatIndex","humidity","response_time","temperature"],"values":[["2016-06-23T12:38:42Z",12.06,22.15,51.6,2.078549411,22.5]]}]}}

此脚本写入文件,但我只想写入字符串 'test'。

目前,如果不自己编写一些工作,这是不可能的 UDF

如果您想在 Kapacitor 中看到此功能,请打开详细说明您的用例的 feature request