You are not logged in.
Pages: 1
I have a lot of old logs in my /var/log directory that I always forget to delete and they just add to the clutter of the folder. How could I write a script that will delete a log if its older than, lets say, 2 weeks?
Offline
I believe the cleanest way to achieve that would be to modify /etc/logrotate.conf.
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 4
Offline
awesome thanks
Offline
An even better solution is to archive the logs - have logrotate gzip them and dump them in a subdir of /var/log, so you keep it clean. Logs might always come in handy .
Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy
Offline
Pages: 1