Results 1 to 4 of 4
I have a script running as a cronjob
It outputs logs upon each run to /var/log/mylog.log
Is there anyway I can delete this or compress it when it gets too ...
- 04-09-2011 #1Just Joined!
- Join Date
- Jan 2011
- Posts
- 59
How to automatically delete log files?
I have a script running as a cronjob
It outputs logs upon each run to /var/log/mylog.log
Is there anyway I can delete this or compress it when it gets too large?
A cheap and dirty way is to setup another cronjob to delete the log every X interval.... although I'm not sure if that's the proper way
Thanks
- 04-09-2011 #2You must always face the curtain with a bow.
- 04-09-2011 #3forum.guy
- Join Date
- May 2004
- Location
- arch linux
- Posts
- 18,095
logrotate should compress and remove log files automatically:
logrotate
Code:man logrotate
oops, looks like Irithori was quicker than me on the ENTER key.oz
→ new members/users: read this first | new member faq
→ no private messages requesting computer support - post them on the forums!
→ please use the "report post" button to alert our forum admins to problematic posts rather than responding to them yourself.
- 04-11-2011 #4Just Joined!
- Join Date
- Jan 2011
- Posts
- 59
Thanks guys! This looks like what I was looking for
Is there a way to view all the logs that are currently maintained by logrotate? For example, the command "crontab -e" lets you view all the cronjobs for a particular user. Is there an equivalent for logrotate?
Also... Am I correct in assuming that all logs under /var/log/ are automatically maintained by logrotate?


Reply With Quote