[gl-como] Problemini con logrotate

Incubus theincubus@gmail.com
Sab 20 Giu 2009 19:22:39 CEST


Hola

Logrotate non mi ruota/comprime tutti i log :S Per alcuni log (apache)
me li faccio spedire via posta sulla gmail e delayo la compressione al
giorno successivo mentre per altri me li faccio spedire compressi
sempre sulla gmail.
I problemi sono molteplici: alcuni log (ad esempio squid) vengono
sempre cancellati (viene tenuto solo il log della giornata) anche se
la cfg generica dica di tenerli per 7 giorni, altri non vengono
compressi (tipo quelli di ssh).
Ho cambiato la configurazione svariate volte, rimosso il file di
status, forzato la rotazione Nmila volte, provato le singole
configurazioni dei log da sole ma non sono riuscito a risolvere il
problema anche perchè tutt'ora non capisco dove stia :S
Di seguito allego il file di configurazione:

==/etc/logrotate.conf==
# $Header: /var/cvsroot/gentoo-x86/app-admin/logrotate/files/logrotate.conf,v
1.2 2004/07/18 01:58:24 dragonheart Exp $
#
# Logrotate default configuration file for Gentoo Linux
#
# See "man logrotate" for details

# rotate log files daily
daily

# keep 1 weeks worth of backlogs
rotate 7

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
compress

# Rotate even if file is empty
ifempty

# Don't send log to anyone
# Le mail le spedisco IO tramite un altro comando
nomail

# Rotate log in the same directory the log normally resides in
noolddir

# If the log file is missing, (go on to the next one without issuing)
issue an error message
nomissingok

# system-specific logs may be also be configured here.
# Apache2 logrotate snipet for Gentoo Linux
# Contributes by Chuck Short
#
/var/log/apache2/*.log {
	delaycompress
	sharedscripts

	firstaction
		/usr/share/webapps/awstats/awstats/hostroot/cgi-bin/awstats.pl
-config=apache2 -update >> /dev/null 2>&1
	endscript

	postrotate
		/etc/init.d/apache2 reload > /dev/null 2>&1 || true
		echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] Apache: access.log" 	
 -a /var/log/apache2/access.log.1 theincubus@gmail.com
		echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] Apache: error.log"  	
 -a /var/log/apache2/error.log.1  theincubus@gmail.com
		echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] Apache (Horde):
horde.log" -a /var/log/apache2/horde.log.1  theincubus@gmail.com
	endscript
}

/var/log/mail/*.log {
	sharedscripts

	# Genero le statistiche
	firstaction
		/usr/share/webapps/awstats/awstats/hostroot/cgi-bin/awstats.pl
-config=smtp -update >> /dev/null 2>&1
	endscript

	# Log gestiti da syslog-ng che necessita di ricreare/riaprire i file
di log dopo la rotazione
	postrotate
		killall -HUP syslog-ng
		echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] Postfix: warn.log" -a
/var/log/mail/warn.log.1.gz theincubus@gmail.com
		echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] Postfix: mail.log" -a
/var/log/mail/mail.log.1.gz theincubus@gmail.com
		echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] Postfix: info.log" -a
/var/log/mail/info.log.1.gz theincubus@gmail.com
		echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] Courier-pop:
pop3d.log"  -a /var/log/mail/pop3d.log.1.gz theincubus@gmail.com
		echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] Courier-imap:
imapd.log" -a /var/log/mail/imapd.log.1.gz theincubus@gmail.com
	endscript
}

# Proftpd
#
/var/log/proftpd/*.log {
	sharedscripts

	# Genero le statistiche
	firstaction
		/usr/share/webapps/awstats/awstats/hostroot/cgi-bin/awstats.pl
-config=ftp -update -output > /home/apache/html/ftp.htm >> /dev/null
2>&1
	endscript

	# Non serve HUP: il demone rigenera il file quando manca
	postrotate
		echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] ProFTPD: access.log"
-a /var/log/proftpd/access.log.1.gz theincubus@gmail.com
		echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] ProFTPD: error.log"
-a /var/log/proftpd/error.log.1.gz  theincubus@gmail.com
		echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] ProFTPD-mod_mysql:
mysql.log"  -a /var/log/proftpd/mysql.log.1.gz  theincubus@gmail.com
	endscript
}

/var/log/squid/*.log {
	sharedscripts

	# Genero le statistiche
	firstaction
		/usr/share/webapps/awstats/awstats/hostroot/cgi-bin/awstats.pl
-config=squid -update > /dev/null 2>&1
	endscript

	# HUP per far rigenerare il file di log al demone
	postrotate
		/etc/init.d/squid reload > /dev/null 2>&1
		echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] Squid: access.log" -a
/var/log/squid/access.log.1.gz theincubus@gmail.com
		echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] Squid: cache.log"  -a
/var/log/squid/cache.log.1.gz  theincubus@gmail.com
		echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] Squid: store.log"  -a
/var/log/squid/store.log.1.gz  theincubus@gmail.com
	endscript
}

/var/log/sshd/*.log {
    sharedscripts
    postrotate
	echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] Ssh: ssh.log"  -a
/var/log/sshd/ssh.log.1.gz  theincubus@gmail.com
    endscript
}

# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql-init-scripts/files/logrotate.mysql,v
1.1 2007/01/12 16:54:20 chtekk Exp $

/var/log/mysql/*.log {
	sharedscripts

	# Log gestiti da mysqld, il demone necessita HUP per rigenerare/riaprire i log
	postrotate
		killall -HUP mysqld
		echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] MySQL:
error-mysqld.log" -a /var/log/mysql/error-mysqld.log.1.gz
theincubus@gmail.com
		echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] MySQL:
slow_query.log" -a /var/log/mysql/slow_query.log.1.gz
theincubus@gmail.com
	endscript
}

/home/tftp/*config {
    rotate 1
    nocompress
    firstaction
	echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] IOS Backup:
(running-config) - Hellgate: running-config"  -a
/home/tftp/hellgate-running-config theincubus@gmail.com
	echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] IOS Backup:
(startup-config) - Hellgate: startup-config"  -a
/home/tftp/hellgate-startup-config theincubus@gmail.com
    endscript
    postrotate
	mv /home/tftp/hellgate-running-config.1
/home/tftp/hellgate-running-config_`date +%d-%m-%Y`
	mv /home/tftp/hellgate-startup-config.1
/home/tftp/hellgate-startup-config_`date +%d-%m-%Y`
    endscript
}

/var/log/router/*.log {
        sharedscripts

	# Log gestiti da syslog che vuole l'hup per rigenerare/riaprire i log
        postrotate
                killall -HUP syslog-ng
                echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] Router:
Hellgate.log"      -a /var/log/router/Hellgate.log.1.gz
theincubus@gmail.com
                echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] Router:
TerminalDogma.log" -a /var/log/router/TerminalDogma.log.1.gz
theincubus@gmail.com
                echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] Router:
SigmaUnit.log"     -a /var/log/router/SigmaUnit.log.1.gz
theincubus@gmail.com
        endscript
}

/var/log/auth.log {
        sharedscripts
        postrotate
                killall -HUP syslogd-ng
                echo "" | /usr/bin/mutt -s "[`date +%d-%m-%Y`] System:
Auth.log" -a /var/log/auth.log.1.gz theincubus@gmail.com
        endscript
}

/var/log/btmp {
    missingok
    create 0600 root utmp
}

# no packages own lastlog or wtmp -- we'll rotate them here
/var/log/wtmp {
        create 0664 root utmp
}

/var/log/dpsearch/*.log {
        rotate 7
}
# $Header: /var/cvsroot/gentoo-x86/app-admin/syslog-ng/files/syslog-ng.logrotate,v
1.2 2004/07/18 02:25:02 dragonheart Exp $
#
# Syslog-ng logrotate snippet for Gentoo Linux
# contributed by Michael Sterrett
#

/var/log/messages /var/log/syslog{
    sharedscripts
    postrotate
	#        /etc/init.d/syslog-ng reload > /dev/null 2>&1 || true
	killall -HUP syslog-ng
    endscript
}

/var/log/privoxy/privoxy.log{
	sharedscripts
	postrotate
		killall -HUP privoxy > /dev/null 2>&1 || true
	endscript
}

/var/log/tor/*.log {
	missingok
	sharedscripts
	postrotate
		/etc/init.d/tor reload > /dev/null || true
	endscript
}

/var/log/rsync.log {
	maxage 365
	rotate 7
	size=+1024k
	notifempty
	missingok
	copytruncate
}
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id: elog-save-summary 7609 2007-08-15 04:37:36Z zmedico $
# Rotate the log created by the save_summary elog module.

/var/log/portage/elog/summary.log {
    missingok
    nocreate
    delaycompress
}
===EOF===

-- 
KNOWLEDGE IS POWER
http://incubus.homelinux.net
http://www.gl-como.it


Maggiori informazioni sulla lista gl-como