log4net.Elasticsearch Rolling Indexes

Today I made a small update to log4net.Elasticsearch so that users can optionally choose to have new indexes created each day. This was suggested in a Github issue and I think it’s a good idea. Many Elasticsearch indexes are managed on a rotating basis. It’s simple to create index aliases so that if any log readers or applications are reading directly from the Elasticsearch index, the index alias can be established nightly with a routine API call.

The connection string parameter is optional. Simply add

rolling=true

to your usual application connection string and the logger will take care of the rest. You can see an example of the setting on the sample App.config file in the Github repository.

Happy logging!

About JP Toto

JP is a devops developer in Philadelphia, PA. He works at eMoney Advisor by day and attempts to cook by night.

Leave a Reply

Your email address will not be published. Required fields are marked *