InfluxDB 2 influx deleting with additional tags does not work

I want to clear the data of a single data field. Unfortunately it doesn’t work with this code. The command in the CLI is accepted, but no data is deleted. There is also no error message.

influx delete \
  --bucket test \
  --start 1970-01-01T00:00:00Z \
  --stop $(date +"%Y-%m-%dT%H:%M:%SZ") \
  --predicate '_measurement="modbus" AND _field="Netzbezug Energie"'

If I take this code, the complete measurement “modbus” is deleted. Of course I don’t want that.

influx delete \
  --bucket test \
  --start 1970-01-01T00:00:00Z \
  --stop $(date +"%Y-%m-%dT%H:%M:%SZ") \
  --predicate '_measurement="modbus"'

The spelling is fine. Maybe something is wrong with the syntax?

_field=“Netzbezug Energie”

Quite the same here. Maybe something changed within the last 2 weeks, as the exact same command did the job for me two weeks ago. Not sure when the update from 2.6 to 2.6.1 happened, but maybe it has something to do with that?

Even without the additional tag it does not work

This is how my cli command looks like

influx delete --bucket MYDATABASENAME --start ‘2023-01-21T14:12:06.16Z’ --stop ‘2023-01-21T14:51:20.16Z’ --predicate ‘_measurement=“GasZaehlerStandAktuell”’ -o BCO -t MYADMINTOKEN

I have experimented with the timestamps, the apostrophes and the sequence of the commands. Absolutely nothing works.

I am on Influx 2.6.1 running within a LXC container. Strange enough, the exact same command worked for me 2 weeks ago… not that I am aware of any update of the DB since then.

Drives me nuts…

Really nobody any ideas here?

Hello @zaphood and @Cavekeeper,
Hmm I’m not sure.
Does that field exist in multiple measurements?
I think you can just specify the field like:

  --predicate '_field="example-field"'

Hmmm…actually
Looking at this issue though:

Looks like you might need to try:

root@influxdb:/# influx delete --start '1970-01-01T00:00:00Z' --stop $(date +"%Y-%m-%dT%H:%M:%SZ") --predicate '_measurement="fibaro" and \"name\"="motion temp"'

or 

influx delete --bucket pythontest --start 2022-09-09T00:00:00Z  --stop 2022-09-10T00:00:00Z --predicate  "_measurement=\"logging-state\""

Brings me to this documentation:

Which states:

Column limitations when deleting data

InfluxDB 2.6 supports deleting data by any column or tag except the following:

  • _time
  • _field
  • _value

InfluxDB 2.6 does not support deleting data by field.

Thanks a lot for your answer.

The documentation states, that the “–predicate” parameter in 2.6.1 no longer allows deletion by “_field”, but “_measurement” should work. Unfortunately your post doesn’t explain why my example line of code (which seams very similar to what you posted) worked 3 weeks ago…

I was already playing with the times, with or without the nanoseconds, with times at 00:00 or different random values and with or without the different apostrophes. Nothing worked.

I tried to replicate your syntax as well, but without success.

influx delete --bucket "MYDATABASE" --predicate "_measurement="GasZaehlerStandAktuell"" -org "BCO" --start 2023-01-21T14:30:00Z --stop 2023-01-21T14:45:00Z -token MYADMINTOKEN

As somebody stated in annother post, the “–o” and “–t” did not work for him, hence I testet “–org” and “–token” as well, which did not do anything as well. What really puzzles me the most is, that with the line of code above, no error is generated still no data is deleted. When I am playing around with the parametes, all sorts of errors are being generated (wrong date or time, missing credentials, etc). So it seems to me that the command itself is correct, but the DB engine just “doesn’t feel like” really executing anything…

Maybe it is a change between 2.6 and 2.6.1 ? But I am not sure when the update to 2.6.1 happened on my machine, hence I am speculating.