Page 1 of 1

Log Delete

PostPosted: Tue Apr 09, 2013 2:08 am
by gmcust3
I am planning to delete all log files daily under :

/var/log/asterisk/messages
/var/log/asterisk/astguiclient
/etc/asterisk/logger

Safe to delete them ?

Re: Log Delete

PostPosted: Tue Apr 09, 2013 2:35 am
by DomeDan
if you mean /etc/asterisk/logger.conf then no, thats a config-file, no point deleting that one

You can add this to crontab to delete 2 days old logs every night at 00:28 & 00:29
Code: Select all
### remove old vicidial logs and asterisk logs more than 2 days old
28 0 * * * /usr/bin/find /var/log/astguiclient -maxdepth 1 -type f -mtime +2 -print | xargs rm -f
29 0 * * * /usr/bin/find /var/log/asterisk -maxdepth 3 -type f -mtime +2 -print | xargs rm -f

this works if you have logrotate running.

dont you have anything that deletes old logs in your system now?

Re: Log Delete

PostPosted: Tue Apr 09, 2013 2:39 am
by gmcust3
Not right Now.

Re: Log Delete

PostPosted: Tue Apr 09, 2013 2:42 am
by gmcust3
I have

Code: Select all
### remove old vicidial logs and asterisk logs more than 2 days old
28 0 * * * /usr/bin/find /var/log/astguiclient -maxdepth 1 -type f -mtime +2 -print | xargs rm -f
29 0 * * * /usr/bin/find /var/log/asterisk -maxdepth 3 -type f -mtime +2 -print | xargs rm -f
30 0 * * * /usr/bin/find / -maxdepth 1 -name "screenlog.0*" -mtime +4 -print | xargs rm -f

Re: Log Delete

PostPosted: Tue Apr 09, 2013 2:48 am
by DomeDan
see, you had it there already :P
do you have logrotate running? do a "ls -lh /var/log/astguiclient/" to easy find out, logrotate renames files to something.2013-04-08

Re: Log Delete

PostPosted: Wed Apr 10, 2013 8:08 am
by DomeDan
have you come to any conclusions?