File Sink

The sink is used for saving analysis result into a specified file.

Compile & deploy plugin

  1. # cd $kuiper_src
  2. # go build -trimpath --buildmode=plugin -o plugins/sinks/File.so plugins/sinks/file/file.go
  3. # cp plugins/sinks/File.so $kuiper_install/plugins/sinks

Restart the Kuiper server to activate the plugin.

Properties

Property nameOptionalDescription
pathfalseThe file path for saving the result, such as /tmp/result.txt
intervaltrueThe time interval (ms) for writing the analysis result. The default value is 1000, which means write the analysis result with every one second.

Sample usage

Below is a sample for selecting temperature great than 50 degree, and save the result into file /tmp/result.txt with every 5 seconds.

  1. {
  2. "sql": "SELECT * from demo where temperature>50",
  3. "actions": [
  4. {
  5. "file": {
  6. "path": "/tmp/result.txt",
  7. "interval": 5000
  8. }
  9. }
  10. ]
  11. }