On a RedHat Linux server I have a large set of application servers running, and want a uniform logrotate routine for cleaning up log files. Using wildcards is paramount so I don't have to maintain a constantly growing and shrinking list.


Combining wildcards, the "missingok" option AND "olddir" does not seem to work. When I define a pattern for debug log files - which may or may not exist - and only use "missingok", everything is fine. If I add the "olddir" option it fails with:

# logrotate -d /etc/logrotate.d/foobar
reading config file /etc/logrotate.d/foobar
olddir is now old_logs
error: /etc/logrotate.d/foobar:28 error verifying log file path /srv/www/servers/*/logs: No such file or directory
removing last 1 log configs

The config file:

  olddir old_logs

I see there has been a long standing fix in http://rhn.redhat.com/errata/RHBA-2008-0703.html fixing the issue with wildcard and missingok, but has anybody seen or fixed the issue with olddir?

I'm considering skipping olddir and using postrotate + find/mv, but I would like not having to do that.


Fixed upstream: https://github.com/logrotate/logrotate/commit/73493ec38c5e806fa66d8c3f13259775da6282d9


Fix 'olddir' usage with wildcard in the middle of path in the pattern…
… definition when the pattern did not match any log file.
|improve this answer|||||

I met the same issue.

Watch directory with /var/logs/*/*/*.log and use the "missingok" and "olddir" together.

If there's no any log under that directory, it will complain:

error verifying log file path /var/logs/*/*: No such file or directory

@sastorsl how do you do then?

Mine logrotate 3.7.8.

It seems has been fixed in 3.11.0.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.