sudo rm -f /var/log/*.gz<br>Sometimes my syslog grown until 3.2gb how can do it?<br><br><div class="gmail_quote">2009/12/4 Markus Schönhaber <span dir="ltr"><<a href="mailto:ubuntu-users@list-post.mks-mail.de">ubuntu-users@list-post.mks-mail.de</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">04.12.2009 23:38, NoOp:<br>
<div class="im"><br>
> What is the best method to safely clean out old log files? I have log<br>
> files on some of my machines that go back to 2007 & I'm pretty sure that<br>
> I don't need them any longer. I could of course simply rm/delete any<br>
> logs that are older than one month, but wonder if that is the wisest choice.<br>
><br>
> I know how to easily remove the old .gz files:<br>
> $ sudo rm -v /var/log/*.gz<br>
> but older non-.gz files will remain.<br>
><br>
> I have /etc/logrotate.conf set to:<br>
><br>
> # rotate log files weekly<br>
> weekly<br>
> # keep 4 weeks worth of backlogs<br>
> rotate 4<br>
> # create new (empty) log files after rotating old ones<br>
> create<br>
><br>
> but logrotate wasn't set up until about the hardy or intrepid timeframe,<br>
> so I still have a lot of old .gz junk in /var/log.<br>
<br>
</div>I'd use find to get a list of files last modified more than n days ago,<br>
for example<br>
sudo find /var/log -mtime +240<br>
will print a list of files that were modified more than 240 days ago.<br>
You can use find's -delete to get rid of them or rather -exec or<br>
-print/-print0 in combination with xargs to execute arbitrary commands<br>
with those files as an argument (for example to back them up).<br>
<font color="#888888"><br>
--<br>
Regards<br>
  mks<br>
</font><div><div></div><div class="h5"><br>
--<br>
ubuntu-users mailing list<br>
<a href="mailto:ubuntu-users@lists.ubuntu.com">ubuntu-users@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/ubuntu-users" target="_blank">https://lists.ubuntu.com/mailman/listinfo/ubuntu-users</a><br>
</div></div></blockquote></div><br>