The EventLog.CreateEventSource() call creates an event source in Event
Viewer if it does not exist. However, the defaults that it uses for the
Event Source settings are not desirable for my application. In particular,
I would like to have the "Overwrite Events as Needed" option set instead of
the "Overwrite Events older than 7 days" option set upon creation. Is there
a way to change this default setting programmatically in native .NET without
having to manually go into Event Viewer and change it?

Signature
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
EmailID = varnk
Domain = Diebold.com
-----------------------------------
Michael Nemtsev - 12 Mar 2007 20:05 GMT
Hello Ken,
U can use Event Log Management Script tool for this
http://support.microsoft.com/default.aspx?scid=kb;en-us;318763
---
WBR, Michael Nemtsev [C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/
"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
Kn> The EventLog.CreateEventSource() call creates an event source in
Kn> Event Viewer if it does not exist. However, the defaults that it
Kn> uses for the Event Source settings are not desirable for my
Kn> application. In particular, I would like to have the "Overwrite
Kn> Events as Needed" option set instead of the "Overwrite Events older
Kn> than 7 days" option set upon creation. Is there a way to change
Kn> this default setting programmatically in native .NET without having
Kn> to manually go into Event Viewer and change it?
Kn>
Kn> EmailID = varnk
Kn> Domain = Diebold.com
Kn> ----------------------------------
Nate Bolam - 10 Oct 2007 22:01 GMT
Look at the EventLog.ModifyOverflowPolicy method. Set it to OverflowAction.
OverwriteAsNeeded for your custom log.
http://msdn2.microsoft.com/en-us/library/system.diagnostics.eventlog.
modifyoverflowpolicy.aspx