Koozali.org: home of the SME Server

Contribs.org Forums => General Discussion => Topic started by: compliance on July 11, 2007, 03:17:25 AM

Title: how do i erase the logs from the server ?
Post by: compliance on July 11, 2007, 03:17:25 AM
how do i erase the logs from the server ??
Title: how do i erase the logs from the server ?
Post by: bpivk on July 11, 2007, 09:54:26 AM
Logrotate cron should do that for you.
Title: Re: how do i erase the logs from the server ?
Post by: CharlieBrady on July 11, 2007, 03:59:27 PM
Quote from: "compliance"
how do i erase the logs from the server ??


You can use the 'rm' command. But why do you want to erase logs?
Title: erase logs
Post by: compliance on July 11, 2007, 08:20:56 PM
we want to erase them every week after we review them like a weekly procedure.
Title: Re: erase logs
Post by: CharlieBrady on July 11, 2007, 11:31:07 PM
Quote from: "compliance"
we want to erase them every week after we review them like a weekly procedure.


You still haven't said why you want to erase them. You want to erase them because you want to erase them ...
Title: erase logs, yes that's the reason, just erase them
Post by: compliance on July 12, 2007, 12:50:19 AM
no particular reason of why. i hope you can help.
Title: how do i erase the logs from the server ?
Post by: mmccarn on July 15, 2007, 04:58:04 PM
Code: [Select]
rm -f /var/log/<logfilename>

If you're only reviewing log files weekly, be sure to check that your logs contain a weeks worth of data. Specifically, the qpsmtpd logs may contain as little as a few hours worth of data unless you have modified the default log settings (this is true of a system setup with SME 7.0 and subsequently updated to SME 7.1.3 without install the 'logterse' plugin).

The normal unix/linux way to do what you want would be to "rotate" the logs weekly (say every sunday night), then review the most recent rotated copies on Monday mornings.  If Monday is a holiday, your logs would still be there on Tuesday morning.  If you configure your log rotation to only keep one rotated log file the old logs would be deleted automatically the next Sunday when the next log rotation occurs.  (This is pretty easy for syslog, but may be tricky for multilog...)

The only multilog settings I have looked at are not 'templated' in SME, which means any customizations I introduce disappear whenever I install software updates...

You could write a script that runs daily or weekly to consolidate all the info you want to review into a single log file, then overwrite or delete that file each week after you review it.

SME rotates all logs by default as far as I know - your log files will not fill up your server.