Convert TAG to FIELD in InfluxDB

我与影子孤独终老i 提交于 2020-07-19 07:11:05

问题


Is it possible to convert a tag (which is string) to make field (like double) which would contain a transformed version of the tag value? Like an QL update expression?


回答1:


One could use influx_inspect export to dump the database in the line protocol format. Then relevant columns could be grepped and modified with your favorite tool, like python or sed/bash. And the modified time series could be re-inserted directly into the database (one could use split -l 7000 to split field time series into chunks and the use curl -POST .../write?db=... --data-binary @chunk and iterate over those chunks expecting HTTP 204 for correctly inserted values).




回答2:


This is only possibly using Kapacitor

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


来源:https://stackoverflow.com/questions/42392682/convert-tag-to-field-in-influxdb

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!