4

We'd like to monitor the Application Event Logs (the Event Viewer - Application Log in a traditional Windows machine) in Azure App Service. The reason is if our app throws an unhandled exception and crashes during the host start up, IIS log the error message in the Application Event Logs, and we want to monitor this error and get an alert when it happens. Our ASP.NET host handles internal background jobs and there's no public endpoint.

I checked Send Logs to Azure Monitor, but it doesn't do Windows Event Log. Is there other way to monitor the ASP.NET host crash?

One workaround is that App Service has "Total App Domains" metrics. If the host crashes, the app domain count will be 0. But I'm wondering there should be a way to monitor "ASP.NET host crash"?

Jason Pan
  • 15,263
  • 1
  • 14
  • 29
Hengyi
  • 733
  • 11
  • 20

1 Answers1

1

The Event Log is virtualized in Azure App Services. See documentation.

While apps are not permitted to read from or write to the Event Log service per se, a virtualized event log is available which requires no change to app code to use. Events written using the normal event logging APIs will be written to an XML file located at %SYSTEMDRIVE%\home\logfiles\eventlog.xml. This virtualized event log has a rotating limit of 1000 events — events written past this limit still be written, but will cause the oldest events to be removed from the file.

I wanted to create a custom event source, but that also is not possible (since writing to the Registry is also not possible...).

Rossco
  • 1,052
  • 11
  • 24