lager icon indicating copy to clipboard operation
lager copied to clipboard

Keep filename extension in rotation

Open inikulshin opened this issue 4 years ago • 4 comments

Insert file index before filename extension (if exist) and get

filename.0.log
filename.1.log
filename.2.log

instead of

filename.log.0
filename.log.1
filename.log.2

inikulshin avatar Aug 13 '19 09:08 inikulshin

On my FreeBSD 12 system, the index comes at the end of the rotated name (freebsd-var-log.txt). logrotate appears to allow preserving the extension if you specify it.

@inikulshin is there a specific problem you're trying to solve?

lukebakken avatar Aug 13 '19 13:08 lukebakken

Excuse me, I should have mentioned, that I'm working with Windows, which gives special attention to extensions.

E. g. I can define automatic opening of *.log files with some text editor. But .0, .1, etc. - are unknown extensions and double clicking on such files (in explorer) opens dialog with programs list, where I should choose the desired text editor. At least once for each number.

inikulshin avatar Aug 13 '19 16:08 inikulshin

OK, thanks for the explanation. The fastest way to get this implemented would be to submit a pull request with tests.

A workaround on Windows would be to set your text editor as the application for files ending in .0, .1, etc

lukebakken avatar Aug 13 '19 16:08 lukebakken

A workaround on Windows would be to set your text editor as the application for files ending in .0, .1, etc

Sure, that's why I wrote "At least once for each number" and not "Every time" :)

inikulshin avatar Aug 14 '19 07:08 inikulshin