[logback-user] clean up logs after N gigabytes of logs (i.e. ArchiveRemover)

Don Gately dongatelystep13 at gmail.com
Mon Dec 8 14:01:32 CET 2014


Thanks for the reply Bob. Yes, I started looking into unix's logrotate to
handle this need.  I worried about a mix-and-match solution, but if it's
common elsewhere, so be it.  Note that logback's responsibiity doesn't
actually end at rotating; there's support in some of the rotate policies to
do "archive removal" via the class ArchiveRemover, which appears to delete
files older than X days.  I'd be all set if it also supported "deleting
oldest files when total size of all logs exceeds X bytes."

Thanks,
BIM


On Mon, Dec 8, 2014 at 12:11 AM, Robert Kuhar <robertkuhar at gmail.com> wrote:

> This seems like logging infrastructure overreach, to me.  The places I've
> deployed into have all just let the unix environment handle directory
> cleaning.  Logback just rolls the files over daily and/or size based but
> some other cron scripty thing does stuff like rm the files that are more
> than a week old.  It seems that the biggest bang-for-the-buck is to let
> Logback handle the logging and not much else, outsource the rest of the
> work to the environment.  I guess everyone's needs may be different but the
> linux environments I've been working in going on 10 years now all work
> basically in this manner; Logback's responsibility ends at rollover.
> Directory maintenance is the realm of system operations.
>
>
> Bob
>
>
> On Dec 6, 2014 10:17 AM, "Don Gately" <dongatelystep13 at gmail.com> wrote:
>
>> Hi All,
>> I recently filled up a disk with logs, and so now I'm trying to figure
>> out how to ensure that I can set an upper-limit on the size of all logs in
>> the directory.  I've found how to trigger file rollover @ a given size, and
>> how to clean up logs after, say 3 days, but provided I'm thinking about
>> this correctly, what I really want is:
>>
>> 1) roll over logs @ midnight each day
>> 2) cleanup logs if size of all logs gets larger than X bytes
>>
>> I haven't found a way to do this without writing my own RollingPolicy
>> (and maybe TriggerPolicy, NamingPolicy, etc).
>>
>> This seems like it would be a common goal for users, so am I missing some
>> way to do this with Logback off-the-shelf (i.e. no custom code)?
>>
>> Thanks,
>> BIM
>>
>> _______________________________________________
>> Logback-user mailing list
>> Logback-user at qos.ch
>> http://mailman.qos.ch/mailman/listinfo/logback-user
>>
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20141208/82899acc/attachment.html>


More information about the Logback-user mailing list