How to reduce the volume of traces in Logic Apps Standard - azure-application-insights

I'm using the Logic Apps Standard and Application Insights.
Each time a Logic Apps Standard Workflow is triggered, it generates a lot of traces and I want to reduce those traces and avoid having too much data ingestion generated into Application Insights.
I first want to remove traces coming from the storage account that is used behind the scene by the Logic App.
I tried to change the content of the host.json file in order to set this:
"logLevel": {
"default": "Information",
"Host.Results": "Error"
}
Unfortunately, I'm still having a lot of traces as if the host.json file is ignored.
Any ideas?

I want to reduce those traces and avoid having too much data ingestion generated into Application Insights.
You cannot reduce the trace logs. The only possible way is either you have to enable or disable the trace logs in Application Insights.
In your host.json file you keep logLevel has "default": "Information" and "Host.Results": "Error" which means by default the logic app function collect the trace information
To avoid the trace level logs you have to keep the higher level logging. Refer log level
If you don't want the trace information you have to keep your host.json file like below
"logLevel": {
"default": "Error",
"Host.Results": "Error"
}

Related

Filter exceptions sent to Application insights from the client side

I am struggling with the problem that I'm getting a lot of the exceptions in Azure Application Insights with this error message: Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute.
I understand that I need to add crossorigin="anonymous" to the script tag, but the problem is that these errors are generated from Ads script (which also loads other scripts) on our site, so I can't actually put that attribute for all of them.
Basically I don't even care about these errors, so I just don't want to send them to the
Application Insights at all. I've added the telementry initializer, which I expected will work to filter the errors, but I still receive a lot of that errors (~100.000 per day). Here is the initializer filtering I tried:
ai.addTelemetryInitializer((item) => {
if (item.baseType == "ExceptionData" && item.baseData &&
item.baseData.exceptions && item.baseData.exceptions.length > 0 &&
item.baseData.exceptions[0].message.startsWith("Script error:")) {
return false;
}
});
Also I've tried to filter it by item.baseData.error, but that also didn't help.
How should I configure the telemetry initializer so I can skip these errors?
You can use Sampling in Application Insights to reduce/skip the errors.
<InitialSamplingPercentage>100</InitialSamplingPercentage> : The amount of telemetry to sample when the app has just started.
<ExcludedTypes>Trace;Exception</ExcludedTypes> : A semi-colon delimited list of types that you do not want to be subject to sampling. Recognized types are: Dependency, Event, Exception, PageView, Request, Trace.
You can refer to How to exclude Exception and Error logging from sampling in Application Insights in .NET Core 2.1?, Filter and preprocess telemetry in the Application Insights SDK and No way to suppress cross-domain script errors from logging?

How do I delete availability tests after moving Applications Insights to another resource group?

I moved applications insights from one resource group to another one. After moving I still can see availability tests in AI although I didn´t mark them for the move. Now I can´t do anything with them - disable, delete, edit.
When I try to delete test I get notification that availability test was deleted. But it was not. When I try to disable it I get notification: Failed to update availabity test. Updating availability test "webtest-appservice" failed with error:
{
"error": {
"code": "ResourceNotFound",
"message": "The Resource 'microsoft.insights/webtests/webtest-appservice-xxxxx-ain' under resource group 'xxx-rsg' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix"
}
}
Is there a way to delete them?
Please try to use the Web Tests - Delete rest api.
On that page, there is a green button "Try it", just click it, and provide any necessary parameters.

Drive Item Detect Sharing Changes via Delta and Notifications

I'm having trouble detecting sharing/permissions changes (e.g. shared link) for drive items. Couple of issues I'm running into:
Issue 1:
When Calling Delta:
returns very little information about a shared drive item
E.g:
"shared": {
"scope": "users"
}
If I require more information I may call the permissions api:
https://learn.microsoft.com/en-us/graph/api/resources/permission?view=graph-rest-1.0
So I thought I will try and expand permissions via $expand when calling delta e.g.:
https://graph.microsoft.com/v1.0/drives/b!2sYXPZYs-EWuKr_Zuq-PuJXgC5oupbFGksDDgkXp5Grd_x1DWcntTY1FyJEH9caq/root/delta?$expand=permissions
Unfortunately, am receiving the following error response:
{
"error": {
"code": "invalidRequest",
"message": "The request is malformed or incorrect.",
"innerError": {
"request-id": "ea0ed04a-a4f7-4fbe-a16e-61ff0770fcc0",
"date": "2019-07-29T19:31:37"
}
}
}
I am trying to avoid a "permission" call for each shared item. (I see no point in calling the API for each drive item). Any suggestions?
Issue 2:
I'm using "Notifications/Webhooks" to receive notifications about drive item changes. Notifications work well enough for modify, create, delete, etc...
However, I noticed that when there are "sharing/permission" changes, notifications are not sent.
Ideas? Is this a limitation? (Why is it not documented?).
Thank you.
I have an update and a partial answer:
It is possible to solve these two issues, but the solution is undocumented.
This may change in the future and Microsoft at some point may document it.
(If and when it is officially documented I'll update my answer).
If anyone is running into the same issue, the best course of action is to reach out to Microsoft through partnership channels and/or support.

WHat is the cause of "GatewayTimeout" when deploying ARM Templates?

I'm re-deploying an ARM template.
Whereas it worked last night (...) it's failing with:
{
"error": {
"code": "GatewayTimeout",
"message": "The gateway did not receive a response from 'Microsoft.Maps' within the specified time period."
}
}
This in turn causes the deployment to hang (for an hour+).
I'm pretty sure (but not 100%) that I didn't do a change that would cause this -- is this a Microsoft infrastructure problem?
If so, is there an url on Microsoft that provides information as to the status of services, and ETA as to when it would come back online?
If not, any way of getting more verbose error status report to ferret out the underlying cause (by me?). Thanks.
Turned out to be on the Azure Management API side of things, offline for a half day. The service remained up, but management/deployment apis down for a bit.

Getting "Resource not found error" while using Azure File Sync

Facing a very strange issue.
Following this guide https://azure.microsoft.com/en-in/documentation/articles/app-service-mobile-xamarin-forms-blob-storage/ to implement File Sync in Xamarin Forms app.
The Get method in my service (GetUser, default get method in App service controller) is being called thrice & on the 3rd iteration it gives me a 404 resource not found error. First 2 iterations work fine.
This is the client call
await userTable.PullAsync(
null,
userTable.Where(x => x.Email == userEmail), false, new System.Threading.CancellationToken(), null);
If I remove the following line,
// Initialize file sync
this.client.InitializeFileSyncContext(new TodoItemFileSyncHandler(this), store);
then the code works just fine, without any errors.
I will need some time doing a sample project, meanwhile if anyone can shed some light, it will be of help.
Thanks
This won't be an answer, because there isn't enough information to go on. When you get a 404, it's because the backend returned a 404. The ideal situation is:
Turn on Diagnostic Logging in the Azure Portal for your backend
Use Fiddler to monitor the requests
When the request causes a 404, look at what is actually happening
If you are using an ASP.NET backend (and I'm assuming you are because all the File tutorials use ASP.NET), then you can set a breakpoint on the appropriate method in the backend and follow it through. You will need to deploy a debug version of your code.
this is sorted now, eventually I had to give it what it was asking for. I had to create a storage controller for User too, although I don't need one as I don't need to save any files in storage against the users.
I am testing the app further now to see if this sorts my problem completely or I need a storage controller for every entity I use in my app.
In which case it will be really odd as I don't intend to use the storage for all my entities.

Resources