0

Platform:

RHEL 7
logrotate-3.8.6-7.el7_2.x86_64

Background:

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.

Issue:

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:

/srv/www/servers/*/logs/*_foobar.txt
{
  daily
  olddir old_logs
  missingok
}

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.

0

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

Quote:

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

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.

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.