Azure / azure-functions-host

The host/runtime that powers Azure Functions
https://functions.azure.com
MIT License
1.94k stars 441 forks source link

Log stream shows logs from all apps/functions #8689

Closed arynaq closed 2 years ago

arynaq commented 2 years ago

I couldn't find any related issues here (might be my lacking search-fu) but we are seeing some weird/unexpected behavior in azure function app log streaming (in Function App -> Monitor -> Log stream) in the portal. I suspect the weird behavior is caused by the fact that we have more than one app / function streaming to the same app insights instance, but that I gather to be the whole point, to have centralized logging on the platform.

There are two issues:

Issue A

Issue B

Investigative information

Please provide the following:

Repro steps

Provide the steps required to reproduce the problem:

  1. Log to same app insights instance from more than one function app
  2. Go to any of the above function apps -> Monitoring -> Log Stream
  3. Application insights log stream shows logs from other function apps (and other apps in general)
  4. Filesystem logs does not load (blank UI)

Expected behavior

Actual behavior

Known workarounds

Be slower in iterations and wait for actual logs in app insights so traces can be filtered with KQL, not optimal.

DBJDBJ commented 2 years ago

Try AF tagging perhaps?

https://www.codeproject.com/Tips/5294072/Add-tags-to-Azure-functions-Application-Insights

kshyju commented 2 years ago

@RohitRanjanMS Could you help with this question?

RohitRanjanMS commented 2 years ago

thanks @kshyju, I will have a look at it.

RohitRanjanMS commented 2 years ago

Hi @arynaq we don't apply any filter on the log stream. You see everything that is getting logged in AI. You have some ability to apply filters when you go to "Open in Live Metrics" or open it directly from ApplicationInsights.

DBJDBJ commented 2 years ago

Hi @arynaq we don't apply any filter on the log stream. You see everything that is getting logged in AI. You have some ability to apply filters when you go to "Open in Live Metrics" or open it directly from ApplicationInsights.

One might think the issue is not having one log stream per one Azure Function.

RohitRanjanMS commented 2 years ago

Hi @arynaq, it's a fair expectation, probably the confusion is because you are viewing it from a specific function app. Streaming is AI capability; we only fetch the logs from AI and show it in on the portal without any filter.

ghost commented 2 years ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.