Last seen is in the future
Describe the bug We noticed that, for many resources, the "last seen" date is in the future. For the majority of them, the last seen is set to the day after today. Looking at mongodb resources collection, we found resources like:
{
_id: '2e9acf30-f638-41b0-9e2b-c898a236a051',
first_seen: 1677628800,
region: 'eu-north-1',
resource_type: 'Snapshot',
service_name: 'AmazonEC2',
_last_seen_date: ISODate('2025-11-02T00:00:00.000Z'),
_first_seen_date: ISODate('2023-03-01T00:00:00.000Z'),
active: true,
created_at: 1693029581,
last_seen: 1762048809,
deleted_at: 0
}
To Reproduce Steps to reproduce the behavior:
- Go to Resources
- Click on: filter by last seen today
- Scroll down to: resources table
- See: last seen in the future
Expected behavior "last seen" shouldn't be in the future
Screenshots
@ffaraone can you please check raw expenses on the resource details page for those resources? do you see any records about expenses in the future?
db.raw_expenses.find({"cloud_account_id": <cloud_account_id>, "resource_id": <cloud_resource_id>, "start_date": {$gte: ISODate('2025-10-30T00:00:00.000Z')}})
I checked an Azure virtual machine scale set with "last seen" set to tomorrow and it doesn't have expenses in the future (db.raw_expenses.find({"cloud_account_id": "266dc482-1577-446e-8642-f15393a39797", "resource_id": "b7d741fb-347a-4510-be06-734e9d91058f", "start_date": {$gte: ISODate('2025-10-31T00:00:00.000Z')}})). We also see items like "Global-SoftwareUsage-Contracts" whose last seen date appears to be set to the contract expiration date, or VM snapshots whose last seen date appears to be set to the end of the retention period.
Hi @ffaraone! Suppose you've used OptScale resource id instead of cloud_resource_id in your query ("resource_id": "b7d741fb-347a-4510-be06-734e9d91058f"). cloud_resource_id represents an id of resource in Azure cloud, it usually looks like /subscriptions/<subscription>/resourcegroups/<rg>/providers/microsoft.compute/virtualmachinescalesets/<id>. You may get it from resource details page:
Hi @nk-hystax! Yes I used the Optscale resource id in this query:
(db.raw_expenses.find({"cloud_account_id": "266dc482-1577-446e-8642-f15393a39797", "resource_id": "b7d741fb-347a-4510-be06-734e9d91058f", "start_date": {$gte: ISODate('2025-10-31T00:00:00.000Z')}})).
Furthermore, looks like that for resources like in the following screenshot:
The last_seen attribute is set with the contract end date, and if so, IMO, it confuses clients.