PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Logrotate - Probleme auf Syslogserver



wranger2
22.05.13, 09:41
Moin,

ich habe nen Syslogserver der von verschiedenen Geräten (Switche, Router, Linux) entsprechende Pakete entgegen nimmt. Das Funktioniert auch, nur möchte ich die auch entsprechend komprimieren. Da ich die IPs/Hostnamen aber nicht weiss, legt Syslog die Ordner automatisch an weswegen ich im Logrotatet mit Wildcards arbeiten muss.

Funktioniert auch so halb, hier erst mal die Syslog-Konfig:



cat /etc/logrotate.d/syslog
/var/www/syslog/*/* {
daily
rotate 14
compress
# delaycompress
create 700 www-data www-data
postrotate
/usr/bin/killall -HUP syslog-ng
endscript

}

/var/www/syslog/*/*/* {
daily
rotate 14
create 700 www-data www-data
compress
# delaycompress
postrotate
/usr/bin/killall -HUP syslog-ng
endscript


}




Allerdings erzeugt er mir immer Leerdateiene und packt die auch ganz komisch. Erwartet hätte ich:



other.log
other.log.1
other.log.2.gz
other.log.3.gz


Das macht er draus:



[ ] other.log 21-May-2013 08:07 4.5K
[ ] other.log.1.1.1 21-May-2013 06:26 0
[ ] other.log.1.1.1.1.gz 21-May-2013 06:26 0
[ ] other.log.1.1.1.1.gz.1.gz 20-May-2013 06:26 33
[ ] other.log.1.1.1.1.gz.2.gz 18-May-2013 06:31 33
[ ] other.log.1.1.1.2.gz 21-May-2013 06:26 0
[ ] other.log.1.1.1.2.gz.1.gz 20-May-2013 06:26 20
[ ] other.log.1.1.1.2.gz.2.gz 16-May-2013 23:11 33
[ ] other.log.1.1.1.3.gz 21-May-2013 06:26 0
[ ] other.log.1.1.1.3.gz.1.gz 16-May-2013 23:11 20
[ ] other.log.1.1.1.4.gz 16-May-2013 23:11 29K
[ ] other.log.1.2.gz 21-May-2013 06:26 0
[ ] other.log.1.2.gz.1.gz 21-May-2013 06:26 0
[ ] other.log.1.2.gz.1.gz.1.gz 20-May-2013 06:26 33
[ ] other.log.1.2.gz.1.gz.2.gz 18-May-2013 06:31 33
[ ] other.log.1.2.gz.2.gz 21-May-2013 06:26 0
[ ] other.log.1.2.gz.2.gz.1.gz 20-May-2013 06:26 20
[ ] other.log.1.2.gz.2.gz.2.gz 16-May-2013 01:22 33
[ ] other.log.1.2.gz.3.gz 21-May-2013 06:26 0
[ ] other.log.1.2.gz.3.gz.1.gz 16-May-2013 01:22 20
[ ] other.log.1.2.gz.4.gz 16-May-2013 01:22 24K
[ ] other.log.1.gz 21-May-2013 06:26 0
[ ] other.log.1.gz.1.gz 20-May-2013 06:26 734
[ ] other.log.1.gz.2.gz 18-May-2013 23:56 465
[ ] other.log.2.gz 21-May-2013 06:26 0
[ ] other.log.2.gz.1 21-May-2013 06:26 0
[ ] other.log.2.gz.1.1.gz 21-May-2013 06:26 0
[ ] other.log.2.gz.1.2.gz 21-May-2013 06:26 0
[ ] other.log.2.gz.1.2.gz.1.gz 20-May-2013 06:26 20
[ ] other.log.2.gz.1.2.gz.2.gz 16-May-2013 06:29 33
[ ] other.log.2.gz.1.3.gz 21-May-2013 06:26 0
[ ] other.log.2.gz.1.3.gz.1.gz 16-May-2013 06:29 20
[ ] other.log.2.gz.1.4.gz 16-May-2013 06:29 33
[ ] other.log.2.gz.1.gz 20-May-2013 06:26 20
[ ] other.log.2.gz.2.gz 18-May-2013 01:46 2.1K
[ ] other.log.3.gz 21-May-2013 06:26 0
[ ] other.log.3.gz.1.gz 20-May-2013 06:26 20
[ ] other.log.3.gz.2.gz 19-May-2013 06:26 14K
[ ] other.log.4.gz 21-May-2013 06:26 0

wranger2
21.06.13, 07:52
Moinsen,

wer lesen kann ist klar im Vorteil ;)



Please use wildcards with caution. If you specify *, logrotate will
rotate all files, including previously rotated ones. A way around this
is to use the olddir directive or a more exact wildcard (such as
*.log).


Allerdings finde ich die EInstellung ein wenig schwach, es sollte Ausnahmen für Endungen wie z.B. (.gz) geben. Naja seis drum.

Ich habe zumindest den syslog-ng nun so eingerichtet, das dieser jeder Logdatei die Endung .log gibt und dann das Skript entsprechend angepasst zu:



/var/www/syslog/*/*.log {
daily
rotate 14
compress
# delaycompress
create 700 www-data www-data
postrotate
/usr/bin/killall -HUP syslog-ng
endscript
}
/var/www/syslog/*/*/*.log {
daily
rotate 14
create 700 www-data www-data
compress
delaycompress
postrotate
/usr/bin/killall -HUP syslog-ng
endscript
}

Nun scheints zu klappen ;)