C# – How long does Windows store event logs from a Windows Service

cevent-logloggingwindows-services

I'm using the Windows Event Log to record logs from a custom Windows Service.

If I need to read a log of say, yesterday, I go to the EventViewer, look for my EventLog and read it. But I'm afraid of what would happen if I needed to access a log from months or even years ago. Is it possible? How long does Windows store my logs? Is it configurable from my Service?

Should I use a third-party logger like NLog, which might be better than the Windows Event Log for my service?

Best Answer

By default, each log (eg: Application, System, etc...) is configured to reach 20 Mb max, using the FIFO principle.

You can modify this size and set up an archiving policy instead of the FIFO method, and you'll never loose your logs again.