Re: Safely clean out old log files?



What is the best method to safely clean out old log files? I have log
files on some of my machines that go back to 2007 & I'm pretty sure that
I don't need them any longer. I could of course simply rm/delete any
logs that are older than one month, but wonder if that is the wisest choice.

I know how to easily remove the old .gz files:
$ sudo rm -v /var/log/*.gz
but older non-.gz files will remain.

I have /etc/logrotate.conf set to:

# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 4
# create new (empty) log files after rotating old ones
create

but logrotate wasn't set up until about the hardy or intrepid timeframe,
so I still have a lot of old .gz junk in /var/log.

Note: standard Ubuntu desktops that have been upgraded from dapper thru
karmic. No special server packages (I use different machines for the
servers).

Suggestions?
Maybe Ray could help :-)

find /var/log -type f -mtime +T -print0 | xargs -0 rm
or
find /var/log -type f -mtime +T -exec rm '{}' +
where T is the number of days (more or less!) of logs that you want to keep

--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users



Relevant Pages

  • Re: Safely clean out old log files?
    ... # create new log files after rotating old ones ... standard Ubuntu desktops that have been upgraded from dapper thru ... No special server packages (I use different machines for the ...
    (Ubuntu)
  • Safely clean out old log files?
    ... What is the best method to safely clean out old log files? ... standard Ubuntu desktops that have been upgraded from dapper thru ... No special server packages (I use different machines for the ...
    (Ubuntu)
  • Re: max-cache-size doesnt work with 9.5.0b1
    ... The machines are diskless, so writing larger log files ... Note that, if this is a thread-related bug, it may not always be ... in the first half of the graphs for both cases). ...
    (freebsd-performance)
  • Is a Service not allowed to write to a network share?
    ... local network, just the 3 machines, no wider access. ... MessageQueueing and also in one instance a VB.Net Windows Forms ... out-of-date log files on the Hosts. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: HUGE GLC*.tmp Temp File
    ... It looks as if an application is creating log files. ... > Bryan McDaniel Wrote: ... >> event logs of these machines, and there is nothing written around the ... >> Cardinal Health Systems Inc. ...
    (microsoft.public.windowsxp.general)