[asterisk-users] Lots and lots of log files

Tzafrir Cohen tzafrir.cohen at xorcom.com
Tue Oct 10 02:13:35 MST 2006


On Mon, Oct 09, 2006 at 01:50:11PM -0400, J. Oquendo wrote:

> >>Edit /etc/asterisk/logger.conf then asterisk -rx "logger reload" or in 
> >>cron the dirty way:
> >>
> >>0 * * * *  ls -ltha /var/log/asterisk/|awk '{print $5,$9}'|grep "0 
> >>"|grep -v [1-9]|xargs rm -rf
> >>    
> >
> >Huh?
> >
> >Is it supposed to pick files in the csv dirs?
> >
> >  
> 
> No: His original post:
> 
> >In my /var/log/asterisk directory I have 492,018 log files, most of which
> >are empty.
> >event_log.XXX queue_log.XXX messages.XXX where XXX is an integer.
> 

In this case, using xargs would exceed the maximal command-line length
(about 128kb on Linux).

Use a loop: for file in messages.* queue_log.*; do rm file; done

Slower, but would work.

One hint: check the log rotation configuration. Don't simply rotate
/var/log/asterisk/*' . Is this the case?

-- 
Tzafrir Cohen         sip:tzafrir at local.xorcom.com
icq#16849755          iax:tzafrir at local.xorcom.com
+972-50-7952406          jabber:tzafrir at jabber.org
tzafrir.cohen at xorcom.com     http://www.xorcom.com


More information about the asterisk-users mailing list