在InfluxDB中将TAG转换为FIELD

时间:2017-02-22 13:21:26

标签: influxdb

是否可以将标记(字符串)转换为包含标记值转换版本的字段(如double)?像QL更新表达式?

2 个答案:

答案 0 :(得分:3)

这可能仅使用Kapacitor

stream()
  |from()
    .measurement('mymeasurement')
  |log() // outputs the current state of the pipelie
  |eval(lambda: float("mytag"))
    .as('myfield')
    .keep()
  |log()

答案 1 :(得分:3)

可以使用influx_inspect export转储line protocol format中的数据库。然后可以使用您喜欢的工具(如python或sed / bash)对相关列进行grepped和修改。修改后的时间序列可以直接重新插入到数据库中(可以使用split -l 7000将字段时间序列拆分为块并使用curl -POST .../write?db=... --data-binary @chunk并迭代那些期望HTTP 204正确插入值的块)。

相关问题