Someone just asked me 'how long should we keep logs for our application', and my answer was 'until the disk is full' as there's no reason to throw them away other than running out of space.
However, standard logrotate wants us to specify a specific period + number of rotations. Is there something similar that would let us say "rotate daily, and keep as much history as you like until there is only 5% space free"?
The platform is Redhat Linux.
You can perhaps use firstaction or lastaction directives to call a shell script that tests for disk free space, and then run a delete on the oldest files.
Update:
Here's a Stackoverflow post on the type of script you can run:
https://stackoverflow.com/questions/7523059/remove-oldest-file-in-repository
logrotate itself has no such option. You can add a cron script that find the oldest log to remove whenever the free space falls below your criteria. You can do some other validation as well. However, getting disk too full all the time is not a good idea because the system will not be able to create large temporary files and could cause application failures.
I just wanted to point out there are cases where you don't want your logs to fill all available disk space. I have dealt with several hosts with thin provisioned /var directories and keeping the logs to a certain size was crucial. We used a cronies job in conjunction with logrorate to keep the size down. Something similar could be used in your environment, although a central log server like splunk or syslog-ng would probably be a better option.
As @cjc suggested, you can use firstaction. See this example:
In this example you removed the files bigger than 1GB from the /mnt/user partition if the partition used space is more than the 50%.