2

Every day at midnight, the achievement processes with logrotate begin, which I have set up.

But I'm faced with the problem that once the rotation is finished, it has the name of the current day and I'm interested in the name being the previous day.

My version of logrotate is: 3.8.6

My configuration file logrotate.conf contains:

/mylogs/thelogs {
    missingok
    daily
    copytruncate
    create 0644 root utmp
    rotate 6
    dateyesterday
}

I've tried changing 'dataext' to 'dateyesterday' but it's still doing exactly the same thing.

Thanks for the help.

3
  • Looking at man logrotate, I think you need to give both dateext and dateyesterday, otherwise you probably get .1, .2 etc. again. Commented Dec 8, 2017 at 11:23
  • then if I understand correctly, the configuration should be: /mylogs/thelogs { missingok daily copytruncate create 0644 root utmp rotate 6 dateext dateyesterday } I'll try it... thank you.
    – xav
    Commented Dec 8, 2017 at 11:32
  • I have tried using only dateyesterday, but also leaving dateext and dateyesterday together. But it does not change the name of the log, the date of the current day applies.
    – xav
    Commented Dec 8, 2017 at 14:40

2 Answers 2

3

I add my experience

I need both dateext and dateyesterday options.

If I omit dateext, I obtain numbered files (.1, .2, .3, etc...)

0

By having the rotate configuration both within two files:

etc/logrotate.conf etc/logrotate.d/syslog

The changes I made were not working properly.

After leaving the configuration only in logrotate.conf; the answer of Ulrich Schwarz in the comments has worked correctly.

Greetings

You must log in to answer this question.

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