Remove measurement with special characters

Hi,
I’ve accidentally saved some data to Influx (InfluxDB v2.3.0) with measurements that have special characters in them. i.e.

[‘N2’]
[‘1’]

I have been successfully using the following command to remove data where needed, but even by delimiting the characters with backslashes, I just can’t seem to get rid of it. Here’s the command I’ve tried:

influx delete --bucket “BUCKET_HERE” --predicate ‘_measurement=“[‘N2’]”’ --o ORG_HERE --token “TOKEN_HERE” --start 1970-01-01T00:00:00Z --stop $(date +“%Y-%m-%dT%H:%M:%SZ”) --skip-verify

I don’t get an error when running the command, it just doesn’t do anything.

What am I doing wrong?

If the value is literally "['N2']" I’d try by escaping its special chars. for sure the double quotes.

try with something like influx delete {....} --predicate _measurement="\"['N2']\""

note: I’m not sure about how many quotes are actually needed, escape the ones of the value itself

Thanks for the suggestion. I’ve update the original examples as they were slightly misleading.

I’ve tried some combinations of character escaping, and I’m presuming it’s the quotes that are the issue, but haven’t managed to find the answer yet. I’ve also tried escaping the brackets:

--predicate '_measurement="\[\'N2\'\]"'
--predicate '_measurement="[\'N2\']"'

I believe the --predicate command needs opening and closing single brackets, as per the instructions here:

thanks for the samples, given the following syntax:
'_measurement="example-measurement" AND exampleTag="exampleTagValue"'

The double quotes are required around the actual value, but I need to know what is your exact value, from what you have posted it seems just ['N2'], which does not look special. as far as I know only double quotes are to be escaped (in influxdb1, I can’t find info about v2).

I’d ask you to post the actual name of the measurements, you may want to also check for hidden/unprintable characters…
I’d also try to delete using the API

The samples in the first post are actual measurements.

I’ll check for hidden characters, need to work out the syntax to do that. And also learn how to use API calls.

Thanks

So I managed to work out a Flux command to pull _measurement names, and here’s what I see…excuse the relatively unformatted output…

> _start:time                      _stop:time     _measurement:string                      _time:time
> ------------------------------  ------------------------------  ----------------------  ------------------------------
> 2022-08-22T09:56:07.867496419Z      2022-08-24T09:56:07.867496419Z                   ['1']     2022-08-22T10:35:47.000000000Z

From what I can see, the measurement name is just as I quoted above?

On to trying with the API…

Tried the API route and am getting an error, despite using a freshly created, full access token:

{“code”:“unauthorized”,“message”:“unauthorized access”}–header: command not found

Here’s the redacted command in question:

curl --insecure --request POST https://localhost:8086/api/v2/delete?org=ORG_HERE&bucket=BUCKET_HERE \
--header 'Authorization: Token TOKEN_HERE' \
--header 'Content-Type: application/json' \
--data '{"start": "1970-01-01T00:00:00Z", "stop": "2022-08-24T00:00:00Z", "predicate": "_measurement=\"['N2']\""}'

Any ideas on where I’m going wrong?

@Anaisdg do you have any idea bout how to perform this delete?

Just bumping this thread to see if anyone else can help…

So I got nowhere with this and in the end just emptied the entire bucket.

I think this is a bug that needs some looking at.