question

cyril-4124 avatar image
0 Votes"
cyril-4124 asked SwathiDhanwada-MSFT commented

How to send an email when we log something starting with 'IMPORTANT:'?

We would like to send email alert when a stderr or stdout line starts with "IMPORTANT:"

I couldn't find this kind of condition in App Services > monitoring > alerts tool, is there a way? We have this feature in Heroku and really need it

Thanks

azure-webappsazure-monitor
· 8
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.

@cyril-4124
Thank you for your post!

  • How're you trying to send an email? Is this through Outlook?

  • Are you trying to do this for an Azure Web App? Or where are the logs located?

  • Can you share some more context behind your environment so I can gain a better understanding of your issue?

Any additional information or screenshots would definitely be appreciated.


If you have any other questions, please let me know.
Thank you for your time and patience throughout this issue.

0 Votes 0 ·

@cyril-4124
I just wanted to check in and see if you had any other questions or if you were able to resolve this issue?

0 Votes 0 ·

Hi @JamesTran-MSFT,

We're simply running a server app using App Services, and based on the console log that we send through the running application (using node.js) we want to send emails (not spefically outlook addresses, does it matter?)

so if we do a console.log('IMPORTANT: error doing this or that'); we want to receive an email with this line

Is it more clear? I could send you a screenshot about the app in portal.azure.com, what specifically?

Stack: Node
Major version: Node 14
App type: app,linux

0 Votes 0 ·

In last resort, we would send an email from the application itself, but we would prefer not, as it can happen in critical times, in an exception, before the app crashes

0 Votes 0 ·

@JamesTran-MSFT is the context description clear enough now?

basically, we'd like to use https://docs.microsoft.com/en-us/azure/azure-monitor/logs/data-platform-logs but we're not sure the Alert rules would allow to be triggered based on stdout/stderr app logs, what's your advise on this please?

0 Votes 0 ·

@JamesTran-MSFT any suggestion please?

0 Votes 0 ·

@cyril-4124
Thank you for the quick and detailed response and I apologize for my delayed reply!


Based off your responses, it sounds like you're using an app within Azure App Services, and want to leverage Azure Monitor logs. Therefore, I've added the "azure-webapps" and "azure-monitor" tags to this thread, so experts within these communities can take a look into your issue.

Since this issue doesn't seem related to AzureAD, I've removed the "azure-ad-app-development" tag, and have also reached out to our Azure web apps and Azure monitor engineers so they can take a look into this issue.


Please allow some time for them to look into this issue and respond.
Thank you for your time and patience throughout this issue.

1 Vote 1 ·
Show more comments

1 Answer

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

@cyril-4124 You can store all the console logs (standard output or standard error) in Log Analytics by enabling the diagnostic settings in the App service. "AppServiceConsoleLogs" table stores the information related to console logs. (or)

When you enable "setAutoCollectConsole(true, true)" function in the application code, the information related to stdout\stderr are stored in "requests" table of Application Insights resource.

You can create log alert by writing a kusto query using either of the tables "AppServiceConsoleLogs" or "requests"

Kindly note I don't have test environment to check the logs and provide an appropriate solution. However, kindly check those logs and see if it helps.



· 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.