question

JuanPabloOlguin-5057 avatar image
0 Votes"
JuanPabloOlguin-5057 asked MughundhanRaveendran-MSFT commented

Azure functions logs taking 5 minutes or longer to show up

Hello everyone,

We are developing a fairly complex Function app composed of several functions that's running but every time some of the functions logs some error, the error log for that function in order to show in monitoring is taking 5 minutes to appear, and sometimes even longer. This is causing the feedback loop too long and slowing us down noticeably.

Each successful whole execution of the function only takes 300-500 ms on average. We are on development phase so the whole instance is under no stress, not even high load and yet we cannot see the error log until several minutes have passed. We are not sure but if you print the content of some variable it seems to take longer (if you use logging.info method instead of logging.error).

I have seen some answers on stackoverflow mentioning you can send the logs to other service like a DB, or I was thinking, to some azure storage container but we will be dealing with many different tenants and azure storage containers so I don't want to complicate things like this.

Is there any way to make the functions error log appear on each function's monitoring log right away or at least with a few seconds of delays?

Thank you

azure-functionsazure-monitor
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.

1 Answer

MughundhanRaveendran-MSFT avatar image
0 Votes"
MughundhanRaveendran-MSFT answered MughundhanRaveendran-MSFT commented

@JuanPabloOlguin-5057 ,

Thanks for reaching out to Q&A.

As you mentioned, for the logs/function invocations to appear in the monitor section may be delayed for upto 5 minutes. This is an expected behavior and it is mentioned in the portal

143866-image.png

If you are looking for the logs to appear instantaneously , you can switch to logs tab in the same monitor section which displays the log streaming service.

143855-image.png

I would also suggest you to look into the Live metrics of the Function app's Application insights which will show the logs right away.

  • Navigate to Application insights in the Function app and click on it.

  • Select the Live metrics and you will see the request, response, invocations , trace etc. The sample telemetry in the live metrics will be very helpful for your scenario

143856-image.png

Feel free to reach out to me if you have any queries.

I hope this helps!

Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.


image.png (4.1 KiB)
image.png (47.1 KiB)
image.png (120.8 KiB)
· 2
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.

Yep this works, thanks!.

Verbose mode generates too many messages but you can filter them out which is good. Also the messages are like events so they are not very cleanly formatted and I cannot see the whole stack trace maybe because it is too long.

Anyway huge improvement, the messages appear and they appear fast enough. Thanks again.

0 Votes 0 ·

@JuanPabloOlguin-5057 , I am glad that this approach work for you. Yes, as you mentioned verbose gives lot of information and can be changed to error/information/warning. Failures blade under the App insights would give the complete stack in case of errors/exception

0 Votes 0 ·