Can you query the ApiManagementGatewayLogs in Azure using Invoke-AzOperationalInsightsQuery? - azure

I want to query the ApiManagementGatewayLogs table for an API Management service in Azure using Invoke-AzOperationalInsightsQuery. I can query Log Analytics workspaces fine with this command. I am not able to do this with API Management because I cannot find the workspace ID.
In API Management service, the Logs blade (under "Monitor") uses the Log Analytics icon and it leads you to think it may have a workspace underlying it. Having this workspace would let me call Invoke-AzOperationalInsightsQuery with the subscription plus workspace values. I think. Right now, I don't know if there is a workspace associated to the API Management service or if it is a munged storage that gets created with a Log Analytics icon.
Looking at the dedicated Log Analytic workspaces reveals that none have the ApiManagementGatewayLogs table that is found in the API Management service. So it looks like there is no connection between the API Management service and an existing Log Analytics workspace.
If there is no way to query API Management using Invoke-AzOperationalInsightsQuery, is there some Powershell equivalent for querying an API Management service using KQL?

I found the solution to this.
In API Management blade, there is a "Diagnostics settings" link under the Monitoring section.
Your logs will need to be set up here for storage in a storage account, Log Analytics workspace, event hub or partner solution.
If you are using a Log Analytics workspace, then this will be the workspace you use when invoking the Invoke-AzOperationalInsightsQuery Powershell command.
The APIM will ship your ApiManagementGatewayLogs table to the workspace configured in Diagnostic settings.

Related

Is there a way for me to offload an App Service Plan to Log Analytics?

I wan to see logs of the nodes of my app service plan in Log Analytics. I DONT want to do it with app service. I need to query data of my nodes with KQL
Unfortunately, it's impossible as of now. Please vote up for this user voice: Request to manage diagnostic settings for App Service Plan from Azure portal.
I also tried from both azure portal and rest api:
From azure portal, there is no the option of Diagnostic settings for app service plan.
From api Diagnostic Settings - Create Or Update: It throws an error says that app service plan is not in the whitelist which means that it's not supported currently.
Hope Microsoft can implement this feature for service plan asap:).

How to connect existing Automation Account and Log Analytics workspace in Azure?

I have one Log Analytics workspace "demo-law-sea" and one Automation Account "demo-aa-sea" in the same region of Azure. I want to create "Start/Stop VMs during off-hours".
It requests a Log Analytics workspace and an Automation Account. I simply choose "demo-law-sea", but I cannot choose "demo-aa-sea" because they are not linked.
Then I go to both Log Analytics workspace and Automation Account to see if I can link them together. Either one has Related Resource to refer to the other, but they have only unlink button but not link.
To proceed I create a new Automation Account with selected Log Analytics workspace while creating "Start/Stop VMs during off-hours", then I delete the existing Automation Account "demo-aa-sea".
Is there a way to link existing Log Analytic workspace and Automation Account? Any prerequisites? Thanks.
Under your Automation Account in azure portal -> click Update Management in the left menu, then you can select the proper Log Analytics.

Azure - monitoring resources using REST APIs

I am new to Azure and have been going through various tutorials.
I am looking specifically at Azure Monitoring using REST APIs.
What I am trying to do is get the status of various resources like Virtual Networks, AD, Load Balancers etc on a custom dashboard using REST APIs.
I have found some list of REST APIs that allow monitoring here(https://learn.microsoft.com/en-us/rest/api/monitor/)
But do they provide Resource health and Status.Also, do i have a create a new Service API Managament Resource(which is a paid resource) in the Azure Account for these APIs to run?.
Please let me know if you have any insights or reference materials on this
I don't think rest API is good for monitoring. I will suggest use Azure Monitor service under that you can use Azure resource metrics, Activity logs and service health. based on these metrics and logs you can set alert and show live data on the dashboard.
We are using Microsoft OMS for live monitoring (visualization of data) and Email/SMS for notification.
List item
Audit and receive notifications about important actions in your Azure subscription

How to display azure app service's web server log on Azure log Analytics?

I have an api application hosted on azure App services. For the web server log (iis logs) I've turned on web server logging from Azure portal. Look at the screenshot below.
For storing web server logging
Server Logs are allowed to be stored on the Azure blob containers only. As per the configuration the logs are stored on blob container as expected. Now I want to use these logs to be displayed on Azure Log Analytics.
I've the following storage configurations on Log Analytics in Azure Web portal.
On Log Analytics explorer I can view logs from all other sources except the web server (iis logs). What I'm missing here?
Verified with App Services team that Log Analytics is only supported at the IaaS (VM) level, not at PaaS (App Service) level.
Hopefully we can get this on their roadmap soon - for now you have to manually ingest this data into an external log management tool (Splunk, Sumo Logic, Azure Data Explorer).
Update 12/02/2019
Azure App Service has announced a Public Preview for IIS App Log integration with Azure Log Analytics.
Expanding on the prior answer, under the Diagnostic settings (preview) pane you can now integrate multiple logs to Azure via Add diagnostics setting, this can store:
AppServiceAntivirusScanAuditLogs
AppServiceHTTPLogs
AppServiceConsoleLogs
AppServiceAppLogs
AppServiceFileAuditLogs
AppServiceAuditLogs
AppServiceIPSecAuditLogs
AppServicePlatformLogs
AllMetrics
You can send them to:
Log Analytics workspace
Archive to storage account
Stream to event hub
Send to partner solution
Additionally, Application Insights is migrating to be backed by Log Analytics so we are getting close to fully integrated platform for metrics and logs

How to upload custom metrics and metrics data on azure that can be seen on Azure Management Portal in Diagnostics Monitor

I am working on an application with requirement of insert/upload data on azure that can be seen on Azure Management Portal in Diagnostics Monitor/dashboard
that shows performance counter data in form of graphs, charts.
I want to know how to upload data on azure.
How to see uploaded data in Azure Management Portal Diagnostics Monitor/dashboard (in form of graphs/charts)
Can this be done by creating custom metrics? If yes, how to create custom metrics and monitor? Can it be done using REST API?
If it is not possible to upload and view my own data on Azure Management Portal - Diagnostics Monitor (graph, chart) using custom monitor the is it possible at all to upload and view my own data in Azure Management Portal - Diagnostics Monitor/dashboard?
I am new to Azure. Please suggest if this is possible.
You need to configure Azure Diagnostics. The process is described here for Azure Cloud Services and Virtual Machines:
https://azure.microsoft.com/en-us/documentation/articles/vs-azure-tools-diagnostics-for-cloud-services-and-virtual-machines/

Resources