There is an example how it is possible to query
- LogAnalytics Workspace Logs or
- Metrics for individual resources
using Node.Js:
But I could not find if there is an option to query Logs from AppInsights or from resource directly.
I need it to automate reporting of the performance, so I am planning to query requests
table (we send logs using https://github.com/microsoft/ApplicationInsights-Java). Currently report is done manually using Performance blade of the AppInsights – checking Avg and 99 percentile for requests with specific filters on URL
2
Answers
server.js
, addView Logs in Application Insights
Application Insights
Instance =>Logs
under Monitoring = > Click on tracesPlease refer Node.js services with Application Insights for more information
You can setup logs ingestion from your application to Log Analytics Workspace using Diagnostic Settings. For example, if you host your app in WebApp you can send
AppServiceHTTPLogs
. And then in your Node.JS app you can use@azure/monitor-query
package with a similar query:That one is a close approximation of the performance blade from app insights.
And then your whole app could be