Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am developing an application that creates Windows event logs and writes to them.

However, during development and testing, I created some event logs by mistake, with sources registered to them.

The issue is that only the first 8 characters of the event log name are significant. Now that I have logs with incorrect names, I cannot create the new logs that I need.

Is there any way to totally remove these event logs (and not just clear them)?

I have tried to delete the file C:\Windows\System32\winevt\Logs\WrongNamedEventLog.evtx, but with no success.

share|improve this question
    
any final solution with full source code sample? maybe C# and Powershell and/or BAT-CMD scripts? –  Kiquenet Jun 5 at 6:47
add comment

2 Answers

up vote 4 down vote accepted

Do it programmatically, like this (C#):

System.Diagnostics.EventLog.Delete("WrongNamedEventLog");
share|improve this answer
    
Thanks. There no other way, to just delete it somehow from Windows Administrator UI? –  bzamfir Mar 12 '12 at 7:40
    
Not AFAIK. Probably to avoid any accidental deletion of logfiles –  Mathias R. Jessen Mar 12 '12 at 8:04
add comment

I haven't tested this, but if I was in your case...
Use regedit to browse this path, and delete your custom bogus logs:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\LogToDelete
Reboot
Then delete the corresponding files from:
C:\Windows\System32\winevt\Logs
and/or
C:\windows\system32\config

share|improve this answer
    
Thanks. I'll test. However, it would be nice if reboot wasn't involved... :) –  bzamfir Mar 14 '12 at 15:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.