Updating a host value


I think this has been discussed many times, but I wanted to know if for example I changed a host’s name, is it possible to rename the value displayed in the metrics, so I don’t know see separate values for the old/new name.

Something like update TAG Value or Update value (if it’s not a tag value)?

Hello @reuvygroovy,
A colleague has provided a much more elegant answer here.

"In general, time series data is composed of measurements taken at various point in time. It would be unusual to change the value of a measurement after it was taken. If you record the temperature in a room at 10:00am, for example, that value would remain static.

If you want to change the tags for a measurement, it usually makes sense to create a new series with the updated information and then drop the original series.

While it’s technically true that you can overwrite the existing measurement, it’s important to understand the particular use case when someone asks whether they can update data in InfluxDB.

When many users ask that question, they are thinking about it in the context of a relational database and CRUD operations, where updates are frequent, and for which InfluxDB is not well suited.

Repairing data caused by a firmware issue causing fields to be swapped is a one-time replacement of the data in storage; once that is done, the data generally won’t be changed again."

I saw that post already. But here I thought for a moment, that possibly my question is different. Since I am not looking to change the value of the DATA collected, just the name of the host (or TAG value).

Another words, we have a computer called PC, and we collect let’s say CPU stats for it. The name “PC” will never change, and will always be static. But now if I changed the name of PC to PC1, I find it quite strange that I now need to lose all of my old historical data and start from scratch. I don’t see that the connection is to a relational database here.

InfluxDB, unless I misunderstand, is a repository of data. I should be able to modify a record, regardless or what type it is. I don’t quite fully understand the answer provided in the above post (this after reading it a few times). Maybe you can elaborate on my question and/or the post with an example?

As far as I know tags can’t be updated.
What you can do in order to achieve that is to write duplicate points with the desired “updated” tag value. You will then need to drop the old series.

So in practice you are creating a new series, that mirrors the old one (except for what you want to update) and then delete the old one.

Ok. Can you tell me how to go about doing that?

I’ve never done this before, but for what I’ve found on StackOverflow you can:

  1. Query the data using curl and then write the result to a file (influx will return data in json format)
    so it will be something like:
curl __ApiCallWithYourQuery__  > MyData.json
#Your query should get only the needed data so WHERE computer = "PC"
  1. Then edit the json to update your values and load it in influxDB (see the post in StackOverflow).
  2. Finally check the data and if everything is ok drop the old series