I'm working on a Azure project which has several Azure functions app. One function app is linked to one Application Insights. So we have as much as functions app as Applications Insights.
These functions app will talk between them, and some processes can pass by multiple functions app. On the Azure function, I add logs with a custom EntityID and this EntityID is the same between all function apps.
Now my question is : How I can retrieve all the logs with the same EntityID on all the Applications Insights ?
Like :
traces
| where operation_Name == "TestLogManagement"
| where customDimensions.EventId == 888
but on several Applications Insights.
I know that we can regroup multiple Applications Insights by a Tag but no way to retrieve my logs after I created it.
app('app1').traces
| union app('app2').traces
| where * contains "42"
| summarize count() by appId
Please have a look here:
Unify multiple Azure Monitor Application Insights resources
You can also do this in workbooks in azure monitor, so you don't need to encode app names in the query, you can just write the query you want and pick multiple instances of either AI resources or LA workspaces
Related
There is a Logic Apps management API (https://learn.microsoft.com/en-us/rest/api/logic/workflows)
As far as I understood you cannot use the service to access Standard Logic Apps. Is there a work around? Basically I need to retrieve a few days of action outputs of my running workflow. TIA
Basically I need to retrieve a few days of action outputs of my running workflow.
Like mentioned by #Thomas, One of the workarounds is to enable application insights from your logic apps and then retrieve the action outputs of your workflow in log analytics using KQL.
In Application Insights, I'm using the below query to get the information about each and every action where its state is in Running.
traces
| where cloud_RoleName == "<Your_LogicApp_Name>"
| where message contains "Running"
| where operation_Name != ""
We are creating a POC to use Azure Applications Insights with WebAPI application.
We have added a telemetrykey to the webapi and we can see logs in Azure insights trace and requests tabs.
However, what we would like to do is rather than using the existing trace and requests provided by Azure, we would like to create our own tab say "OurCustomLog" and we would like to create own columns like 'CreatedDate', 'TransactionId', 'LogDetails', 'StatusCode', 'LoggingApplicationName', 'CallingApplicationName' etc and then we can filter based on for example, statusCode or TransactionId etc.
Is this possible with Azure Application Insights? or Are there different services in Azure we should use instead of Azure Insights?
Thank you in advance,
Kind regards,
This is all possible. I'd say the best thing to do is create Azure Monitor Workbooks. Based on the existing logs you can create queries to transform and rename the data. You can add tabs, visualizations and filters to your liking.
To see the default workbooks and create new ones browse to your App Insights Resources and select Workbooks in the left side menu in the category Monitoring
When creating queries you can map columns name like this:
requests
| project CreatedDate = timestamp
or you rename them in the workbook itself.
The other options is writing and sharing custom queries.
I ended up changing queries in Traces in Azure App insights based on
https://learn.microsoft.com/en-us/azure/data-explorer/kusto/concepts/
You could do something like this,
traces
| extend d=parse_xml(message)
| extend SRID=d.TransactionDetail.SRId, LoggerApplication=d.TransactionDetail.LoggerApplication, LogLevel=d.TransactionDetail.LogLevel, ClientApplicationName=d.TransactionDetail.ClientApplicationName, TrackingKey=d.TransactionDetail.TrackingKey, HostName=d.TransactionDetail.HostName, LogType=d.TransactionDetail.LogType, LogDetails=d.TransactionDetail.LogDetails, CreatedOn=d.TransactionDetail.CreatedOn, TransactionId=d.TransactionDetail.TransactionId
| where TransactionId == "24b1d5a3-da93-4674-85ea-98adcda1e99f"
|project LogLevel, LoggerApplication, LogType, LogDetails, CreatedOn, ClientApplicationName, SRID, TransactionId, TrackingKey, HostName
I have accepted Peter Bons as it is relevant and and also I can achieve with Azure workbooks as well.
Thanks a lot Peter for your inputs!
This answer summarizes that App Insights (AI) and Log Analytics (LA) are being merged into one service. It also provides a suggestion that new resources in AI can point at LA, so that all your code is in one place.
My question is how can I query across LA and AI resources, given that both exist, and you don't have the time or permissions to change the AI to point at LA.
Using Azure Workbooks I realised I can query from multiple resources inside LA or AI, but I don't seem to be able to query across LA and AI in one cell (nor save results between cells.)
At present the only ways I can think to solve this are to query through the API or joining in a PBI report, but both of these are massive overhead to complete exploratory querying. Is there an easier way, ideally whilst staying inside Kusto queries?
Azure Monitor is your one-stop shop for querying across cross-resources.
Previously with Azure Monitor, you could only analyze data from within
the current workspace, and it limited your ability to query across
multiple workspaces defined in your subscription. Additionally, you
could only search telemetry items collected from your web-based
application with Application Insights directly in Application Insights
or from Visual Studio. This also made it a challenge to natively
analyze operational and application data together.
Now you can query not only across multiple Log Analytics workspaces,
but also data from a specific Application Insights app in the same
resource group, another resource group, or another subscription. This
provides you with a system-wide view of your data. You can only
perform these types of queries in Log Analytics.
To reference another workspace in your query, use the workspace identifier, and for an app from Application Insights, use the app identifier.
For example, you can query multiple resources from any of your resource instances, these can be workspaces and apps combined like below.
// crossResource function that scopes my Application Insights resources
union withsource= SourceApp
app('Contoso-app1').requests,
app('Contoso-app2').requests,
app('Contoso-app3').requests,
app('Contoso-app4').requests,
app('Contoso-app5').requests
Or like,
union Update, workspace("contosoretail-it").Update, workspace("b459b4u5-912x-46d5-9cb1-p43069212nb4").Update
| where TimeGenerated >= ago(1h)
| where UpdateState == "Needed"
| summarize dcount(Computer) by Classification
Or like,
applicationsScoping
| where timestamp > ago(12h)
| where success == 'False'
| parse SourceApp with * '(' applicationName ')' *
| summarize count() by applicationName, bin(timestamp, 1h)
| render timechart
For details, refer this.
Our service writes a lot of custom events and metrics to App Insights.
Using the AI portal we can make complex queries and see nice charts, but I would like to access the data from outside the portal.
The Azure Application Insights REST API page (https://dev.applicationinsights.io) claims that those API can be used to perform such task, but I am unable to make them work - again I want to query custom events and metrics, not the standard ones.
Does anyone have any examples?
Here is for example one our queries:
customEvents
| where name startswith "Monitor.Xxxxxxx"
| summarize count() by bin(timestamp, 1min)
| order by timestamp desc
It turned out I was using the wrong AppId/Key; once I plugged the correct ones I am able to use the API Explorer.
I have the following resources
One Mobile/API app
One MVC app
Three Logic apps
One Azure function deployment with 5 functions
I want to have a single tracking number (correlation ID) to track across all instances at the same time. I'm looking at the Contoso Insurance sample, but I'm rebuilding it by hand (not using Azure Deploy scripts).
I've read the deployment code, but I'm not sure if I can merge app insight logs together, or if it's a hack of some sort.
Observations
When I right click on visual studio, I can only associate to Application insights instances that aren't already connected to a *app (web | mobile | api).
However, in the configuration, I can give Application insights a direct GUID which might allow me to achieve the goal of one App Insights activity log for the entire process
Question
Is it possible to have one app insights log among all Mobile/API/Logic/MVC sites?
Is there a way to have (or should I have) one standard app insights instance per web app, then a special dedicated shared app insights instance for my code to call into and log?
What is contoso insurance doing with Azure App Insights?
Jeff from Logic Apps team here -- So the answer is yes - but there are some caveats. We are working to make the experience seamless and automatic, but for now it will require the following. First as a heads up:
First, for Logic Apps we have what's called the client tracking ID -- this is a header you can set on an incoming HTTP Request or Service Bus message to track and correlate events across actions. It will be sent to all steps (functions, connectors, etc.) with the x-ms-client-tracking-id header.
Logic Apps emits all logs to Azure Monitor - which unfortunately today only has a sink into Event Hubs, Storage, and Log Analytics -- not App Insights.
With all of that in-mind, here's the architecture we see many following:
Have your web apps just emit to App Insights directly. Use some correlation ID as needed. When firing any Logic Apps, pass in the x-ms-client-tracking-id header so you can correlate events.
Log your events to App Insights in the Function app. This blog details some of how to do that, and it is also being worked on for a better experience soon.
In your logic app - either write a Function to consume events off of Azure monitor and push to App Insights, or write a function that is an App Insight "logger" that you can call in your workflow to also get the data into App Insights.
This is how Contoso Insurance is leveraging App Insights as far as I understand. We are working across all teams (App Insights, Azure Monitor, Azure Functions, Logic Apps) to make this super-simple and integrated in the coming weeks/months, but for now achievable with above. Feel free to reach out for any ?s