how to delete logs autom.

zebbie

Verified User
Joined
May 30, 2007
Messages
34
Hello,

Every 2 weeks I have to delete some logs in my /var/log directory otherwise my device is full again...
Is there a way to delete these logs automatic or can I stop my device from logging?

does anyone have an option?

thanx

Zebbie
 
Set up a cron job to run every two weeks to do it. Remember to restart the daemons that write to the logs.
 
I created a cron job to run every 2 days!

This is in the cron file:

rm -rf /var/log/httpd/access_log.1

-----------------
But it is'n working...can anyone help?
 
That cronjob will only remove /var/log/httpd/access_log.1.

Do you want it to remove some other logfiles as well? If so, which ones?

Jeff
 
this is the only file I want to be removed.

But the problem is that this file is not deleted with the cron job.

Is there something wrong with this job?
 
You stated;

delete some logs in my /var/log directory

But you neglected to tell everyone which log files your talking about. If they are not system logs then you need to setup log rotation for any log file outside the scope of what is currently being rotated by the system.

If log rotation is for system logs (default) and they are not rotating like they should then you need to find out whats going on with your log rotation.

If these are log files, not part of the system logs, then you need to setup your own logrotation as part of the systems.
 
I made this cron job:

1-59 * * * * rm -rf /var/log/httpd/access_log.1

But he doesn't delete the file. What am I doing wrong?
 
Try to add root at the begining :)
Code:
* * * * * root rm -f /var/log/httpd/access_log.1
 
You need to add them to /etc/crontab :) Or create a new file in /etc/cron.d.
 
Back
Top