Francisco,

Your second call to `listUsageRecords` not returning anything has to do with the timezone defined for aggregation (`usage.aggregation.timezone`), the aggregation range (`usage.stats.job.aggregation.range`), and how the API uses the provided dates.

Currently, as the aggregation timezone is set to `GMT` and the aggregation range is set to `1440` minutes (1 day), your usage records for August 25th will have `2025-08-25T00:00:00+0000` as their start date and `2025-08-25T23:59:59+0000` as their end date (usage is aggregated for each day in GMT).

When you call `listUsageRecords`, the API will search for usage records that have both the start and end dates between the provided `startdate` and `enddate` parameters. However, there are no usage records with both the start and end dates between `2025-08-24T22:00:00+0000` and `2025-08-25T21:59:59+0000` (the dates you provided converted to GMT). That is why no records are returned.

The usage records for August 25th should be returned if you pass GMT as the timezone:

```
(admin) 🐢 > list usagerecords startdate="2025-08-25T00:00:00+0000" enddate="2025-08-25T23:59:59+0000"
```

If you wish for future usage records to align with your local timezone, you can change `usage.aggregation.timezone` to GMT+2 (note that this will not affect the existing records). In this case, it may be interesting to change `usage.execution.timezone` as well so that Usage executes 15 minutes after a day in your local timezone ends.

On 9/1/25 09:10, Francisco Arencibia Quesada wrote:
Hi Fabricio,

usage.aggregation.timezone: GMT
usage.execution.timezone: ""
usage.stats.job.aggregation.range: 1440
usage.stats.job.exec.time: 00:15

The CS version is 4.20.1

Thanks for your help in advance
best regards

On Mon, Sep 1, 2025 at 2:04 PM Fabricio Duarte <
[email protected]> wrote:

Hi Francisco,

What CloudStack version are you using? Also, could you provide what
value do the global settings `usage.aggregation.timezone`,
`usage.execution.timezone`, `usage.stats.job.aggregation.range` and
`usage.stats.job.exec.time` have?

On 9/1/25 05:50, Francisco Arencibia Quesada wrote:
Hi all,

We are facing an issue with the list usageRecords command in a CloudStack
environment.

Running:

cloudmonkey list usageRecords startdate="2025-08-24T00:00:00+0200"
enddate="2025-08-25T23:59:59+0200"

→ returns data.

But running:

cloudmonkey list usageRecords startdate="2025-08-25T00:00:00+0200"
enddate="2025-08-25T23:59:59+0200"

→ returns nothing.

On other CloudStack environments with the same version and configuration,
both queries work as expected.

We already checked:

     -

     Locale configuration on the management server:

     locale -k LC_NUMERIC | egrep 'decimal_point|thousands_sep'
     decimal_point="."
     thousands_sep=","

     (previously thousands_sep was empty, we fixed it but the problem
     remains).
     -

     Compared cloudstack-usage configuration with another environment
where
     usage records are returned correctly.

Has anyone experienced this behavior before, or know if it could be
related
to how CloudStack interprets dates in the list usageRecords API call?

Thanks in advance,
--
*Francisco Arencibia Quesada.*
*DevOps Engineer*


Reply via email to