Azure / azure-libraries-for-net

Azure libraries for .Net
MIT License
377 stars 190 forks source link

Activity logs returning empty results #1251

Open micyunmsft opened 2 years ago

micyunmsft commented 2 years ago
 IEnumerable<IEventData> logs = azure.ActivityLogs
                        .DefineQuery()
                        .StartingFrom(DateTime.Now.AddDays(-30))
                        .EndsBefore(DateTime.Now)
                        .WithAllPropertiesInResponse()
                        .FilterByResource(resourceId)
                        .Execute();

I've recently noticed that the above code no longer returns any activity logs for my resource. However, I can see activity log entries in the Azure portal.

image

ghost commented 2 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzMonEssential.

Issue Details
```` IEnumerable logs = azure.ActivityLogs .DefineQuery() .StartingFrom(DateTime.Now.AddDays(-30)) .EndsBefore(DateTime.Now) .WithAllPropertiesInResponse() .FilterByResource(resourceId) .Execute(); ```` I've recently noticed that the above code no longer returns any activity logs for my resource. However, I can see activity log entries in the Azure portal. ![image](https://user-images.githubusercontent.com/87725769/126395293-fd802022-d709-4758-bd90-07920a06ef1d.png)
Author: micyunmsft
Assignees: -
Labels: `Bug`, `Monitor - ActivityLogs`, `Service Attention`
Milestone: -
weidongxu-microsoft commented 2 years ago

To ActivityLog service

The REST API appears always return empty values. https://github.com/Azure/azure-rest-api-specs/blob/master/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/activityLogs_API.json#L39

[ForkJoinPool-1-worker-51] INFO com.azure.resourcemanager.monitor.implementation.ActivityLogsClientImpl$ActivityLogsService.list - --> GET https://management.azure.com/subscriptions/###/providers/Microsoft.Insights/eventtypes/management/values?api-version=2015-04-01&$filter=eventTimestamp%20ge%20%272021-07-14T03%3A17%3A14.550803900Z%27%20and%20eventTimestamp%20le%20%272021-07-21T03%3A17%3A14.550803900Z%27%20and%20resourceUri%20eq%20%27/subscriptions/###/resourceGroups/rgmonitor934806f1/providers/Microsoft.Storage/storageAccounts/samonitor2307262b%27
Try count: 1
Date:Wed, 21 Jul 2021 03:17:16 GMT
Content-Length:0
x-ms-client-request-id:df56d2f8-a8fc-4a70-abc1-62d34f1f7f80
Accept:application/json
(empty body)
--> END GET

[reactor-http-nio-5] INFO com.azure.resourcemanager.monitor.implementation.ActivityLogsClientImpl$ActivityLogsService.list - <-- 200 https://management.azure.com/subscriptions/###/providers/Microsoft.Insights/eventtypes/management/values?api-version=2015-04-01&$filter=eventTimestamp%20ge%20%272021-07-14T03%3A17%3A14.550803900Z%27%20and%20eventTimestamp%20le%20%272021-07-21T03%3A17%3A14.550803900Z%27%20and%20resourceUri%20eq%20%27/subscriptions/###/resourceGroups/rgmonitor934806f1/providers/Microsoft.Storage/storageAccounts/samonitor2307262b%27 (340 ms, 12-byte body)
Cache-Control:no-cache
Pragma:no-cache
Content-Type:application/json; charset=utf-8
Expires:-1
Vary:Accept-Encoding
x-ms-request-id:SouthEastAsia_bbeb1d9725a446d08000a9495649a952_637624342376127771
Server:Microsoft-IIS/10.0
x-ms-ratelimit-remaining-subscription-reads:11996
x-ms-correlation-request-id:8d86e2be-add3-4ed5-a489-8573fe39f2b0
x-ms-routing-request-id:SOUTHEASTASIA:20210721T031717Z:8d86e2be-add3-4ed5-a489-8573fe39f2b0
X-Content-Type-Options:nosniff
Date:Wed, 21 Jul 2021 03:17:17 GMT
content-length:12
Response body:
{
  "value" : [ ]
}
<-- END HTTP
micyunmsft commented 2 years ago

Any ETA on this? Or suggestions on what APIs I can use instead while waiting for this to be fixed? Thanks.

weidongxu-microsoft commented 2 years ago

@AzMonEssential Any idea what is happening? Or is this API being replaced?

micyunmsft commented 2 years ago

@AzMonEssential Friendly ping. We have an important internal tool that depends on retrieving the activity logs in order to determine resource usage, which then informs budget planning. Because of this bug, the tool hasn't been able to function for several weeks now.

asheniam commented 2 years ago

Azure Portal today is relying on a different api-version and backend system that we have not yet publicly documented. This will explain why you will see differences in the Azure Portal experience and the documented API experience. Due to some scaling concerns in the backend, we have intentionally not publicly documented this api-version but are working towards releasing this more broadly towards the end of this calendar year.

In order to troubleshoot the issue that you are seeing, we will need more information such as the subscription ID that it will be better to investigate through a support ticket. Can you open a support ticket to track this request? Please include the information in this GitHub issue and also include a note that this should be routed to the product team.

micyunmsft commented 2 years ago

Thanks, I have opened a support ticket.