Deleting measurements

OK, I give up.
Please tell me I’m missing something obvious.

I am trying to delete a measurement - with all data inside it - from the InfluxDB 2 database. I don’t care about what this measurement contains - tags, field keys, values, whatever - I just want to remove it.

I was expecting that the builtin web interface allows this, but it doesn’t. (Why not? I can remove buckets, but no measurements within a bucket. A data editor which can do this, and also allows modification of tags and field values would be really nice.)

So I tried the command line. There is a influx delete option, but the parameters this option needs are so needlessly complicated that everything around them screams “DO NOT USE ME”:

  1. I need to specify --start and --stop parameters for a time range. I don’t want to, a _measurement= predicate would be perfectly sufficient for my needs. Why do I have to specify a time range? Please make deletion work without a time range if a measurement is specified.
  2. Start and Stop parameters absolutely must be in RFC3339 format. I cannot omit the time (e.g. just say “2022-01-06”) and I cannot specify any time format that the Linux date command can output. without also having to use a sed hack to insert the “T” between date and time. Why does this command not AT LEAST accept relative time specs like Flux does, i.e. “-24h” or “-3d” or “15m”? This makes no sense. Please add this functionality.
  3. But that’s not all: it seems that if the rows in my measurement have tags, I also need to find out which ones and specify all of those in the command line, otherwise deletion will fail.

Please make influx delete more user friendly, by allowing to delete complete measurements regardless of contents, and allowing easy relative start and stop values to be specified. The status quo seems needlessly complicated - and “yes, but that’s just the way Influx is designed” is not a solution, since users could always wrap a script around this complexity, but IMHO this should not be neessary.

And, while we are at it, a data editor in the web UI would be really great. Sometimes I need to correct values, delete single datapoints, rename measurements (especially when experimenting) or add/remove tags. This is really hard to do on the command line. I would pay for such a feature to be included in InfluxDB OSS.

Thank you!

1 Like

Hello,

You can try on a prompt the command below.
Don’t forget to replace

  • MyTokenXXX
  • MyBucketXXX
  • MyMeasurementXXX
influx delete   --org 'influxdb'   --token 'MyTokenXXX'   --bucket 'MyBucketXXX'   --start 1970-01-01T00:00:00Z   --stop $(date +"%Y-%m-%dT%H:%M:%SZ")   --predicate '_measurement="MyMeasurementXXX"'

Keep us informed !

1 Like

Hello neuvidor,

thank you - supplying “dummy” date parameters works indeed.
Can we now please make these implicit in the influx binary when they are not supplied?
That would save users the effort of writing wrapper scripts just to supply dummy parameters … :slight_smile:

-Jens

how to achieve this by using curl?
when posting the following:

            command = {
                "start": "1970-01-01T00:00:00Z",
                "stop": '$(date +"%Y-%m-%dT%H:%M:%SZ")',
                "predicate": f'_measurement="{measurement}"'
            }

the server complains:

‘invalid request; error parsing request json: invalid RFC3339Nano for field stop, please format your time with RFC3339Nano format, example: 2009-01-01T23:00:00Z’