0

I have below given sampleMeasurement1; I want to update values of respective columns in InfluxDB. How to update those values?

SELECT * FROM sampleMeasurement1; 
{ "results": [ { "series": [ { "name": "sampleMeasurement1", "columns": [ "time", "disk_type", "field1", "field2", "hostname" ], "values": [ [ 1520315870774000000, null, 12212, 22.44, "server001" ], [ 1520315870843000000, "HDD", 112, 21.44, "localhost" ] ] } ] } ] }
Balasubramanian
  • 700
  • 7
  • 26

1 Answers1

0

We can't change tag values via InfluxDB commands, we can however write a client script that can change the value of a tag by inserting "duplicate" points in the measurement with the same timestamp, fieldset and tagset, except that the desired tag will have its value changed.

Point with wrong tag ( https://docs.influxdata.com/influxdb/v1.4/write_protocols/line_protocol_reference/#syntax ):

cpu,hostname=machine.lan cpu=50 1514970123 After running

INSERT cpu,hostname=machine.mydomain.com cpu=50 1514970123 a SELECT * FROM CPU would include

cpu,hostname=machine.lan cpu=50 1514970123 cpu,hostname=machine.mydomain.com cpu=50 1514970123 After the script runs all the INSERT commands, you'll need to drop the obsolete series of points with the old tag value:

DROP SERIES FROM cpu WHERE hostname='machine.lan'

Change tag value in InfluxDB