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 :-)
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
12-04-2009, 09:57 PM
Markus Schönhaber
Safely clean out old log files?
04.12.2009 23:38, NoOp:
> 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.
I'd use find to get a list of files last modified more than n days ago,
for example
sudo find /var/log -mtime +240
will print a list of files that were modified more than 240 days ago.
You can use find's -delete to get rid of them or rather -exec or
-print/-print0 in combination with xargs to execute arbitrary commands
with those files as an argument (for example to back them up).
--
Regards
mks
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
12-04-2009, 10:06 PM
Tom H
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@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
12-04-2009, 10:34 PM
"lcn.mustard"
Safely clean out old log files?
NoOp wrote:
> 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 :-)
>
>
>
>
>
My ubuntu karmic always crash when I click in log view
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
12-04-2009, 10:40 PM
"Amedee Van Gasse (ub)"
Safely clean out old log files?
On Fri, December 4, 2009 23:38, NoOp wrote:
> 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.
Others have already given good answers, but I am wondering why logrotate
doesn't pick up old logfiles. That sounds like a bug to me...
--
Amedee
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
12-04-2009, 11:37 PM
NoOp
Safely clean out old log files?
On 12/04/2009 03:06 PM, Tom H wrote:
>> 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
>
Thanks (and thanks Marcus); I used:
$ sudo find /var/log -type f -mtime +T -exec rm '{}' +
('T' was first set for 30 and then tested w/15)
on a test system and it worked just fine. I'll now do the same on my
"backup/mirror" system (the one mirroring this with 2007 logs) & monitor
for a few days to see if removing the old logs have any ill effect. The
systems have full backup's so I can easily restore if necessary.
However, Amedee brings up a good point; why wouldn't logrotate have
cleaned out all of these old logs given my settings? I reckon that's an
excercise for the weekend to figure out :-)
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
12-05-2009, 01:32 PM
luciana mustard
Safely clean out old log files?
sudo rm -f /var/log/*.gz
Sometimes my syslog grown until 3.2gb how can do it?
2009/12/4 Markus Schönhaber <ubuntu-users@list-post.mks-mail.de>
04.12.2009 23:38, NoOp:
> 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.
I'd use find to get a list of files last modified more than n days ago,
for example
sudo find /var/log -mtime +240
will print a list of files that were modified more than 240 days ago.
You can use find's -delete to get rid of them or rather -exec or
-print/-print0 in combination with xargs to execute arbitrary commands
with those files as an argument (for example to back them up).
--
Regards
*mks
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users