'Azure - Log custom events in azure and load logs to show in Asp.net UI
I wish to leverage the logging services/features available in azure (Azure monitor/App insights/Log Analytics/etc ) and use them to store the custom events arising out of customers' actions in my app. Events like updating a record, adding, or deleting records, within my app, and also wish to leverage the search capabilities provided by the azure services, within my App via REST or SDK.
I wish to show those logs in grid form in my Asp.net UI and let the users visualize the logs and take actions after analyzing them. By providing the abstraction, I can give the user the ability to log anything that he likes while using my application and also have a search ability, but I will provide the interface to store and load the logs.
I am thinking that I can use the azure app insights for the same, but I don't see any SDK code or REST API to load the logs, provide the search capabilities to the user.
Is there a better path that I can take than going for Azure app insights?
Solution 1:[1]
Please check if given steps and references help to work around:
am thinking that I can use the azure app insights for the same, but I don't see any SDK code or REST API to load the logs, provide the search capabilities to the user.
You can filter and track the telemetry data before it's sent from the SDK by implementing
ITelemetryProcessor.To get your custom events data, you can use the code like
customEvents | summarize sum(itemCount)in Logs Page which comes from thetrackEvent(...).Here is the MS Doc given code in multiple programming languages to track the custom events and metrics in Analytics.
To provide the custom events and metrics data to the end user, there is the data access API from the Azure Portal.
Other ways to extract data include export from Analytics to Power BI and continuous export.
References:
Solution 2:[2]
I zeroed into using the Log Analytics Workspace's "Custom logs" feature. This provides a REST endpoint to log the data and SDK to retrieve the data. Here is the link.
https://docs.microsoft.com/en-us/azure/azure-monitor/logs/data-collector-api
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | HariKrishnaRajoli-MT |
| Solution 2 | puneet |
