bruno-garcia / log4net.ElasticSearch

log4net appender to ElasticSearch
https://bruno-garcia.github.io/log4net.ElasticSearch/
Other
219 stars 92 forks source link

Index name with format date YYYY.MM instead YYYY.MM.DD #128

Open slav4ik51493 opened 3 years ago

slav4ik51493 commented 3 years ago

Hello everyone! I have issue with rolling index names. How I can provide my specify format of date for rolling?

I use 2.3.7.0 version. I saw source code of 2.5.0 version and this version has public string RollingIndexNameDateFormat { get; set; } = "yyyy.MM.dd";. Okay, I can update to 2.5.0 but don't found info in docs how I can customize this RollingIndexNameDateFormat. Can you provide new version with customization this property?

If somebody know workaround - please, help me.

Thanks!

niccolettag commented 3 years ago

Hi!

I am having the same issue and cannot find a workaround :( Tried to add datepattern tag but it did not help.

Any input would be appreciated.

slav4ik51493 commented 3 years ago

@niccolettag I found solution, but this is not good. I used 2.3.7 version and not found source code for this version. I disassembly with dotPeek 2.3.7 dll and change index format rolling in Models/Uri.cs file, rebuild with Release mode. Next, remove Nuget package from my solution and use my new, changed dll file. This works fine. I know, hard will be update in future this library, but my project like dino :)

bruno-garcia commented 3 years ago

You can customize by setting the format on the appender configuration, like this:

https://github.com/bruno-garcia/log4net.ElasticSearch/blob/3929690800d3f228a33cff0336ca8c941052dd4f/src/log4net.ElasticSearch.Tests/logConfig.xml#L21

gregfurman commented 1 year ago

You can customize by setting the format on the appender configuration, like this:

https://github.com/bruno-garcia/log4net.ElasticSearch/blob/3929690800d3f228a33cff0336ca8c941052dd4f/src/log4net.ElasticSearch.Tests/logConfig.xml#L21

Changing the value to "yyyy-MM" does not work and seemingly just defaults back to "yyyy-MM-dd". We are using log4net.ES v2.5.0 and log4net v2.0.8