question

FredrikHeidgert-6715 avatar image
1 Vote"
FredrikHeidgert-6715 asked FredrikHeidgert-6715 commented

Azure Function app logging makes Application Insights traces show in Live metrics but not under Transaction search

Hello,

I have created a new Function app in Azure. The standard template gets an ILogger in the Run method of the Function that can be used to log to Application Insights. My app is configured to use Application Insights and I can verify that this works if I turn on the Live metrics and trigger my function (Incoming requests shows a spike and my log messages are shown in the "Sample telemetry" panel.

However, the logs I see in the "Sample telemetry" panel can never be found afterwards. I have tried looking in the "Transaction search" but that is completely empty.

I have waited minutes, hours and days. Nothing ever shows up here, even though it continues to show in the "Sample telemetry" panel of the "Live metrics" pane.

Has anyone else experienced something similar? What am I missing?

Kind regards
Fredrik

azure-functionsazure-monitor
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@FredrikHeidgert-6715 did you get a resolution to this problem in the end. I'm seeing the same behaviour.

0 Votes 0 ·

@Bogdan-4963 Yes I did.

In my case it seemed to be related to the fact that the Application Insights resource was in a Resource Group with a swedish "ä" character in it. By creating a new Resource Group that did not contain this character and moving the Application Insights resource to that Resource Group log data started showing up correctly.

I even tried to create a new Resource Group with the "ä" character in it and moving back the Application Insights resource to it. That caused logs to stop being collected. Moving it back to a different Resource Group once again made it working.

Not sure if that's the only case where this can fail, but hopefully it can help you to think a bit on alternative reasons for it to not work in your case.

0 Votes 0 ·
Bogdan-4963 avatar image Bogdan-4963 FredrikHeidgert-6715 ·

Oh, not great you had deal with something like that.
Actually I've just figured out my problem as well: in my case it was to do with the fact that I was running the Azure function inside a VNet and I had a fairly restrictive outbound NetworkSecurityGroup policy with a default Deny All rule.
Once I added an "Allow" rule Outbound for the Service Tag "AzureMonitor" I started to see the Transactions and the Traces in Application Insights.

0 Votes 0 ·

Glad to hear that it worked out for you!

0 Votes 0 ·
olufemiaMSFT avatar image
0 Votes"
olufemiaMSFT answered Ariwibawa-3135 commented

Hello @FredrikHeidgert-6715 , Thanks for your post and sorry for the delayed response.

Try using a custom Telemetry Initiallizer to bypass the sampling module for the set of logs you would like to see in the Live Metrics pane.

101466-livesite-metrics.png



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello olufemia, can you be more specific. Why we need to increase sampling percentage to 100%? Did you mean that there could be log that didn't get collected because of that sampling settings?

We're experiencing the same issue, show up in live metric but couldn't find it under log in request table.

0 Votes 0 ·
Ariwibawa-3135 avatar image
0 Votes"
Ariwibawa-3135 answered

I was on trial, and it seems that it got disable in Cost management & billing. It confused me at first, because I was told that I could use it for a year. And I still have more than 9 months to a year.
So in my case, my subscription got disabled. My application could still send data but maybe appinsights rejected it because of disable subscription.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.