View Single Post
  #16  
Old 12th November 2007, 00:36
satommy satommy is offline
Junior Member
 
Join Date: Oct 2007
Posts: 9
Thanks: 0
Thanked 3 Times in 2 Posts
Default

Quote:
Originally Posted by satommy
OK,

This is how I think it could work:

We create two new files in /etc/logrotate.d/ :

-mail
-messages

These files:

------------------------------------------------------------------
mail:

/var/log/mail.log {
rotate 30
daily
compress
delaycompress
create 644 root adm
}

messages:

/var/log/messages {
rotate 30
daily
compress
delaycompress
create 644 root adm
}

-----------------------------------------------------------

Ok, the rotate setting means how many files he has to keep, 30 files, en daily rotated, so he will keep up for a month.

Further on I took the clamav logrotate files and edit the rights.:

---------------------------------------------------------

clamav-daemon:

/var/log/clamav/clamav.log {
rotate 12
weekly
compress
delaycompress
create 644 clamav adm
postrotate
/etc/init.d/clamav-daemon reload-log > /dev/null
endscript
}

clamav-freshclam:

/var/log/clamav/freshclam.log {
rotate 12
weekly
compress
delaycompress
create 644 clamav adm
postrotate
/etc/init.d/clamav-freshclam reload-log > /dev/null
endscript
}

-----------------------------------------------------

We could just let these files be replaced by the installer.

For chmodding the first log files, so before the logrotate run the first time:

chmod 644 /var/log/mail.log
chmod 644 /var/log/messages
chmod 644 /var/log/clamav/*.log


After these additions I can succesfully read all the log files in the webconfig :-)
In addition to this:

the mail logrotate file needs to be different.

----------------------------------------------------

/etc/logrotate.d/mail :

/var/log/mail.log {
rotate 30
daily
compress
delaycompress
create 644 root adm
}

/var/log/mail.err {
rotate 30
daily
compress
delaycompress
create 644 root adm
}

/var/log/mail.info {
rotate 6
weekly
compress
delaycompress
create 644 root adm
}

/var/log/mail.warn {
rotate 6
weekly
compress
delaycompress
create 644 root adm
}
------------------------------------------------------------

We also need to disable some lines in the /etc/logrotate.conf.

We can do this with the following commands:

---------------------------------------------------------------

sed 's/mail\.\*\t/#mail\.\*\t/' /etc/syslog.conf | sed 's/mail\.info\t/#mail\.info\t/' | sed 's/mail\.warn\t/#mail\.warn\t/' | sed 's/mail\.err\t/#mail\.err\t/' > /etc/syslog.tmp

------------------------------------------------------------

mv -f /etc/syslog.tmp /etc/syslog.conf

----------------------------------------------------------

So this should do the final trick :-)

Gr. Tommy
Reply With Quote