Event Log error - Azure App Service

Steve Wolfe 1 Reputation point
2022-03-09T12:32:30.987+00:00

I have recently deployed an Azure app that is asp.net MVC. I have a few hundred errors showing in my application insights reporting tools. All the errors are the same, which is the below message. I have researched this error and it seems that I do not have logging setup correctly. I have researched options to set this up correctly but not able to find anything. Does anyone else have a solution to this?

"The source was not found, but some or all event logs could not be searched. To create the source, you need permission to read all event logs to make sure that the new source name is unique. Inaccessible logs: Security."

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,872 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Monalla-MSFT 12,121 Reputation points
    2022-03-12T23:34:10.787+00:00

    Hello @Steve Wolfe - Welcome to Microsoft Q&A and thanks for reaching out to us.

    This problem can occur not only due to permissions but may be due to event source key missing because it wasn't registered successfully (you need admin privileges to do it - if you just open Visual Studio as usual and run the program normally it won't be enough). Make sure that your event source "MyApp" is actually registered.

    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. This virtualization is done to enable better debugging of apps as well as to support applications which require, as part of their basic function, the registration and use of event sources. Technically, this virtualization is done in user-mode within the application process itself using API hooking.

    Take a look at this document for more information: Azure-Web-App-sandbox

    UPDATE:

    On Windows, its D:\home\LogFiles\eventlog.xml

    186592-image.png

    For the event log details, take a look at this doc for more reference on creating event source: system.diagnostics.eventlog.createeventsource

    Hope this helps. And please feel free to reach out if you have any further questions.

    ------------------------------------------------------------------

    If the above response was helpful, please feel free to "Accept as Answer" and "Upvote" the same so it can be beneficial to the community.

    1 person found this answer helpful.
    0 comments No comments