log4net.ElasticSearch icon indicating copy to clipboard operation
log4net.ElasticSearch copied to clipboard

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

Open slav4ik51493 opened this issue 5 years ago • 4 comments
trafficstars

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!

slav4ik51493 avatar Nov 03 '20 09:11 slav4ik51493

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.

niccolettag avatar Nov 03 '20 17:11 niccolettag

@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 :)

slav4ik51493 avatar Nov 05 '20 03:11 slav4ik51493

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

bruno-garcia avatar Dec 06 '20 01:12 bruno-garcia

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

gregfurman avatar Aug 26 '22 07:08 gregfurman