logrotate on desktop

Have you ever wondered about stuffed log files generated by your desktop apps? No? Me eiter. Let’s check it out by simple way.
Try to find all files that ends with „log” and are bigger than 100 kB:
$ find $HOME -type f -name '*log' -size +100k -exec ls -lha "{}" \;
Interesting, right? :)

Now, let’s use logrotate to handle the „trash”. If you are using your PC mostly by day you can rotate logs every hour BUT the criteria are verry important, like „minsize 100k”. I’m starting my work early, about 4:30 AM, so logrotate on my Fedora is set on 05:00 AM – my logs are rotating when my morning coffe is still warm :)

Logrotate file, I took lftp for this example:
/home/wojtosz/.lftp/transfer_log
{
compress
dateext
minsize 100k
missingok
notifempty
}

Go try it out for yourselves and free some valuable space on your SSD drives :)

2 thoughts on “logrotate on desktop

  1. another example of log rotation handling; logs will be rotated, but never deleted (rotate time set to 100 years):
    /home/wojtosz/some_app/logs/some_app.log
    {
    compress
    copytruncate
    su http http
    create 0600 http http
    olddir /home/wojtosz/some_app/logs/archive/
    dateext
    daily
    rotate 36500
    minsize 100k
    }

Dodaj komentarz

Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *