2

I'd like logrotate to create files which have nice names. Is there some way to force some pattern for the names after rotation? I'd like to create a service-{year}-{month}-{day}-{hour} format and rotate hourly.

It seems I'm running a version with dateext, but without dateformat. I'd like to use this logging way anyways.

1 Answer 1

10

logrotate configuration file:

dateext
dateformat -%Y-%m-%d-%s

Out:

atop.log-2010-09-30-1285850549

hour is not supported. You can use the postrotate to rename.

3
  • Unfortunately I have to use the debian stable version, so dateext is supported, but dateformat isn't... is there any workaround for this problem?
    – viraptor
    Sep 30, 2010 at 14:43
  • Just what I needed! Jul 10, 2012 at 3:50
  • How can I get the export file name in postrotate?
    – Amintabar
    Feb 13, 2019 at 7:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .