Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deleting Custom Event Log Source Without Using Code

I have an application that has created a number of custom event log sources to help filter its output. How can I delete the custom sources from the machine WITHOUT writing any code as running a quick program using System.Diagnostics.EventLog.Delete is not possible.

I've tried using RegEdit to remove the custom sources from [HKEY_LOCAL_MACHINE\SYSTEM\ControlSetXXX\Services\Eventlog] however the application acts as if the logs still exist behind the scenes.

What else am I missing?

like image 997
Wolfwyrd Avatar asked Sep 24 '08 15:09

Wolfwyrd


People also ask

How do I delete event log source?

The Remove-EventLog cmdlet deletes an event log file from a local or remote computer and unregisters all its event sources for the log. You can also use this cmdlet to unregister event sources without deleting any event logs.

How do I delete a custom view in Event Viewer?

Start Event ViewerUse Right-mouse click on a selected Custom View Filter from the Console Tree, to open drop-down menu. Delete appears fourth from bottom of menu if and only if you are logged on as the user who created that view. Select Delete to remove the Custom View filter.

Can I delete Event Viewer logs?

Open Event Viewer and select the Windows log you wish to clear. Right-click on the log and select Clear Log. Select Save and Clear.

Which of the following methods can be used to delete an event log object?

You can use the static members of EventLog to delete logs, get log lists, create or delete a source, or determine if a computer already contains a particular source. There are three default event logs: Application, System, and Security.


1 Answers

I also think you're in the right place... it's stored in the registry, under the name of the event log. I have a custom event log, under which are multiple event sources.

HKLM\System\CurrentControlSet\Services\Eventlog\LOGNAME\LOGSOURCE1 HKLM\System\CurrentControlSet\Services\Eventlog\LOGNAME\LOGSOURCE2

Those sources have an EventMessageFile key, which is REG_EXPAND_SZ and points to:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\EventLogMessages.dll

I think if you delete the Key that is the log source, LOGSOURCE1 in my example, that should be all that's needed.

For what it's worth, I tried it through .NET and that's what it did. However, it does look like each custom event log also has a source of the same name. If you have a custom log, that could affect your ability to clear it. You'd have to delete the log outright, perhaps. Further, if your app has an installer, I can see that the application name also may be registered as a source in the application event log. One more place to clear.

like image 57
Mike L Avatar answered Oct 07 '22 18:10

Mike L