mongodb-atlas-cli
mongodb-atlas-cli copied to clipboard
Date range filter not working
Describe the bug
Using the command atlas events projects list, the maxDate and minDate filters are not being applied.
The exact command is:
atlas events projects list --output json --projectId 5ef516da5cc30930bcd83889 --maxDate 2024-03-18T15:00:03+00:00Z --minDate 2024-03-18T14:40:03+00:00Z --limit 500 --page 1
I try to get event logs of the last 20 mins, but the result is approximately 11 million records.
I changed the minDate to 24 hours ago, and the totalCount is the same.
Also in the response href:
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas/v2/groups/5ef516da5cc30930bcd83889/events?includeCount=true\u0026includeRaw=false\u0026pageNum=1\u0026itemsPerPage=500",
"rel": "self"
},
{
"href": "https://cloud.mongodb.com/api/atlas/v2/groups/5ef516da5cc30930bcd83889/events?includeCount=true\u0026includeRaw=false\u0026itemsPerPage=500\u0026pageNum=2",
"rel": "next"
}
]
You can't see the dates in the href, so my best guess is that the CLI is not implementing the filter in the request to the server.
To Reproduce Steps to reproduce the behavior:
- Run
atlas events projects listwith the min-max date filter - In the response, verify if the totalCount varies and if the href has the dates in the URL
Expected behavior I need the filters to be implemented so I can get only the logs from a certain period of time.
Desktop (please complete the following information): OS: 3.19.1 NAME="Alpine Linux" ID=alpine VERSION_ID=3.19.1 PRETTY_NAME="Alpine Linux v3.19"
MongoCLI version [e.g. 1.2] atlascli version: 1.14.2 git version: https://github.com/mongodb/mongodb-atlas-cli/commit/47dc06c7a9b1183cd8b0027306dd839d8547893d Go version: go1.21.6 os: linux arch: amd64 compiler: gc
Additional context Pretty sure we don't produce 11 million logs in 20 minutes, I've been trying to retrieve 11 million logs from your system, and after page 1000, I start getting 500 error timeout, just an FYI
Thanks for opening this issue. The ticket CLOUDP-238932 was created for internal tracking.
Hi @LuisCordobaDataSite, thank you for reporting this issue.
We have identified and reproduced your reported error. The root cause is that the timestamp parsing in the command is silently failing, hence the command executes but minDate and maxDate are not actually being set. To fix this, we will open a PR to validate those flags and properly report the issue to users. Furthermore, I'll also add extra docs in the help of the flags, so that we share the expected time format.
Meanwhile, to unblock you, I can suggest that you convert the dates you provided into one of these formats: RFC3339 or "2006-01-02T15:04:05-0700", that should make your command run successfully.
E.g.
atlas events projects list --output json --projectId 5ef516da5cc30930bcd83889 --maxDate 2024-03-18T15:00:03-0000 --minDate 2024-03-18T14:40:03-0000 --limit 500 --page 1
Again, thanks for reporting and apologies for the inconvenience.
Update: the issue has been fixed and will be released on March 27th.