从influxdb删除时,获得无效的RFC3339NANO错误

发布于 2025-02-01 01:18:54 字数 803 浏览 3 评论 0 原文

我是InfruxDB的新手,我想从Postman中删除InfuxDB的一些数据。我正在使用Postman

"data":{    
    "start": "2021-01-09T12:00:00Z",
    "stop": "2021-01-09T12:00:00Z",
    "predicate": "_measurement=\"mymesurement\""
  }
  }

的以下查询,还提供了标题中的授权令牌和内容类型

但是当我执行命令时,它给了我以下错误,

{
    "code": "invalid",
    "message": "invalid request; error parsing request json: invalid RFC3339Nano for field start, please format your time with RFC3339Nano format, example: 2009-01-02T23:00:00Z"
}

但在CLI中也尝试过,但仍会遇到相同的错误。

influx delete 
 --bucket 'mybucket'\
 --org 'myorg' \
 --token 'mytoken'
 --start '2009-01-02T00:00:00.001Z' \
 --stop '2009-01-02TT00:00:00.001Z' \
 --predicate '_measurement=mymesurement'

请帮助我解决这个问题。提前致谢

i am new in influxDB, i want to delete some data from influxDB from postman. I am using below query from postman

"data":{    
    "start": "2021-01-09T12:00:00Z",
    "stop": "2021-01-09T12:00:00Z",
    "predicate": "_measurement=\"mymesurement\""
  }
  }

Also provided the Authorization token and content-type in the header

But when i executed the command it is giving me below error

{
    "code": "invalid",
    "message": "invalid request; error parsing request json: invalid RFC3339Nano for field start, please format your time with RFC3339Nano format, example: 2009-01-02T23:00:00Z"
}

Also tried in CLI but still getting the same error.

influx delete 
 --bucket 'mybucket'\
 --org 'myorg' \
 --token 'mytoken'
 --start '2009-01-02T00:00:00.001Z' \
 --stop '2009-01-02TT00:00:00.001Z' \
 --predicate '_measurement=mymesurement'

Kindly help me to resolve the issue. Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

葵雨 2025-02-08 01:18:54

似乎您需要更新开始和停止字段以遵循RFC3339或RFC3339nano标准,该标准是根据Infruxdb的Golang大会在这里。 That is, RFC3339 = "2021-01-09T12:00:00Z00:00" (4 more digits after the "Z") or RFC3339Nano = "2021-01-09T12:00: 00.000000000Z00:00“ (小数点后和“ Z”之前,还有9位数字,再加上“ Z”之后的4位数字)。

根据

PS:您最好让停止字段与开始时不同。否则,不会删除任何数据。

It seems that you need to update both start and stop field to follow either RFC3339 or RFC3339Nano standard according to InfluxDB's Golang convention here. That is, RFC3339 = "2021-01-09T12:00:00Z00:00" (4 more digits after the "Z") or RFC3339Nano = "2021-01-09T12:00:00.000000000Z00:00" (9 more digits after the decimal point and before the "Z", plus 4 more digits after the "Z") .

InfluxDB support both format according to its original code and its docs.

P.S.: You'd better make the stop field different from the start one. Otherwise, there won't be any data deleted.

毁虫ゝ 2025-02-08 01:18:54

当我尝试通过命令行进行操作时,我遇到了相同的错误。
但是在邮递员上,它对我有用。

以下是我的原始请求的示例: -

发布请求
http:// localhost:8086/api/v2/delete?org = mySampleorg& bucket = mySampleBucket

标题

Authorization:Token MY_PRIVATE_TOKEN
Content-Type:application/json

body

{
    "start": "2023-12-06T00:00:00Z",
    "stop": "2023-12-07T23:00:00Z",
    "predicate": "_measurement=\"sampleMeasurement\" AND sampleTag=\"SAMPLE111\""
}

headers主体此返回一个空的响应,带有状态代码 204 。要确认我运行选择查询,发现特定条目已成功删除。

I was getting the same error when I tried to do it through command line.
But on Postman it worked for me.

Below is a sample based on my original request:-

POST Request
http://localhost:8086/api/v2/delete?org=MySampleOrg&bucket=MySampleBucket

Headers

Authorization:Token MY_PRIVATE_TOKEN
Content-Type:application/json

Body

{
    "start": "2023-12-06T00:00:00Z",
    "stop": "2023-12-07T23:00:00Z",
    "predicate": "_measurement=\"sampleMeasurement\" AND sampleTag=\"SAMPLE111\""
}

This returned an empty response with status code 204. To confirm I ran select query and found that particular entry was deleted successfully.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文