Logrotate rotiert nicht

Alle weiteren Dienste, die nicht in die drei oberen Foren gehören.
Antworten
rooki
Beiträge: 76
Registriert: 10.07.2013 07:13:19

Logrotate rotiert nicht

Beitrag von rooki » 20.12.2013 07:26:30

Hi,
seit der umstellung auf wheezy wird Logrotate nicht mehr ausgeführt. Auf der Suche nach dem Problem habe ich mal gegoogelt und bin auf folgenden Befehl gestoßen um Logrotate manuell auszuführen: -f /etc/logrotate.conf Danach erhalte ich aber -bash: -f: command not found

Hier mal meine conf:

Code: Alles auswählen

# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

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

# uncomment this if you want your log files compressed
compress

# packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp {
    missingok
    monthly
    create 0664 root utmp
    rotate 1
}

/var/log/btmp {
    missingok
    monthly
    create 0660 root utmp
    rotate 1
}

# system-specific logs may be configured here
Hier noch die ctontab:

Code: Alles auswählen

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user	command
17 *	* * *	root    cd / && run-parts --report /etc/cron.hourly
25 6	* * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6	* * 7	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6	1 * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
*/5 * * * * root /usr/local/oscam-watchdog.sh  #Teste ob OScam laeuft (alle 5 Minuten)
45 22 * * 4 root /usr/local/dyndns.sh  #Bei Dyndns einloggen (jeden Donnerstag um 22:45 Uhr)
Wo könnte das Problem liegen ?

Gruß Rooki

Benutzeravatar
4A4B
Beiträge: 981
Registriert: 09.11.2011 11:19:55
Kontaktdaten:

Re: Logrotate rotiert nicht

Beitrag von 4A4B » 20.12.2013 07:59:22

Auf der Suche nach dem Problem habe ich mal gegoogelt und bin auf folgenden Befehl gestoßen um Logrotate manuell auszuführen: -f /etc/logrotate.conf Danach erhalte ich aber -bash: -f: command not found
Da fehlte noch der eigentliche Befehl "logrotate":

Code: Alles auswählen

logrotate -f /etc/logrotate

rooki
Beiträge: 76
Registriert: 10.07.2013 07:13:19

Re: Logrotate rotiert nicht

Beitrag von rooki » 20.12.2013 08:00:59

Hi,
dann erhalte ich: error: cannot stat /etc/logrotate: No such file or directory

Benutzeravatar
4A4B
Beiträge: 981
Registriert: 09.11.2011 11:19:55
Kontaktdaten:

Re: Logrotate rotiert nicht

Beitrag von 4A4B » 20.12.2013 08:02:58

Da hatte ich die Dateiendung unterschlagen :? probier mal so:

Code: Alles auswählen

logrotate -f /etc/logrotate.conf

rooki
Beiträge: 76
Registriert: 10.07.2013 07:13:19

Re: Logrotate rotiert nicht

Beitrag von rooki » 20.12.2013 08:08:08

Hi,
Ausgabe:

Code: Alles auswählen

error: cannot stat /etc/logrotate: No such file or directory
root@IGEL-SERVER:~# logrotate -f /etc/logrotate.conf
error: skipping "/var/log/aptitude" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
error: skipping "/var/log/dpkg.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
error: skipping "/var/log/alternatives.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
error: skipping "/var/log/syslog" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
error: skipping "/var/log/mail.info" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
error: skipping "/var/log/mail.warn" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
error: skipping "/var/log/mail.err" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
error: skipping "/var/log/mail.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
error: skipping "/var/log/daemon.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
error: skipping "/var/log/kern.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
error: skipping "/var/log/auth.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
error: skipping "/var/log/user.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
error: skipping "/var/log/lpr.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
error: skipping "/var/log/cron.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
error: skipping "/var/log/debug" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
error: skipping "/var/log/messages" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
error: skipping "/var/log/wtmp" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
error: skipping "/var/log/btmp" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.

Benutzeravatar
4A4B
Beiträge: 981
Registriert: 09.11.2011 11:19:55
Kontaktdaten:

Re: Logrotate rotiert nicht

Beitrag von 4A4B » 20.12.2013 08:15:34

Naja, die Fehlermeldungen besagen, dass die Dateirechte von /var/log nicht in Ordnung sind

Code: Alles auswählen

ls -ld /var/log

rooki
Beiträge: 76
Registriert: 10.07.2013 07:13:19

Re: Logrotate rotiert nicht

Beitrag von rooki » 20.12.2013 08:21:54

drwxrwxrwt 4 root root 400 Dec 19 14:18 /var/log

Benutzeravatar
4A4B
Beiträge: 981
Registriert: 09.11.2011 11:19:55
Kontaktdaten:

Re: Logrotate rotiert nicht

Beitrag von 4A4B » 20.12.2013 08:27:45

Da sollte eher "drwxr-xr-x" stehen

Code: Alles auswählen

chmod 0755 /var/log

rooki
Beiträge: 76
Registriert: 10.07.2013 07:13:19

Re: Logrotate rotiert nicht

Beitrag von rooki » 20.12.2013 08:33:26

Hi,
das passt wohl jetzt, wird rotiert und gz angelegt. Sollte in der config das "compress" drinstehen oder mit # entfernt weden? Ich hatte das # zu Testzwecken mal entfernt. In meiner alten conf war das nicht scharf, es wurden trotzdem gz erzeugt.

Gruß Rooki

Benutzeravatar
4A4B
Beiträge: 981
Registriert: 09.11.2011 11:19:55
Kontaktdaten:

Re: Logrotate rotiert nicht

Beitrag von 4A4B » 20.12.2013 08:40:38

In meiner alten conf war das nicht scharf, es wurden trotzdem gz erzeugt.
Das ist wohl der Standardwert. Viele Programme haben unterhalb von /etc/logrotate.d ihre eigene Konfiguration.

rooki
Beiträge: 76
Registriert: 10.07.2013 07:13:19

Re: Logrotate rotiert nicht

Beitrag von rooki » 21.12.2013 08:33:18

Hi,

ok also nochmal vielen Dank für deine Hilfe und ein schönes Fest :D

Gruß Rooki

rooki
Beiträge: 76
Registriert: 10.07.2013 07:13:19

Re: Logrotate rotiert nicht

Beitrag von rooki » 12.03.2014 07:46:16

Hi,

ich möchte das Thema gerne nochmal aufgreifen. Ich bin mit meinem Server mittlerweile auf einen Raspberry-Pi umgezogen. Habe alles neu aufgesetzt und bei einem Neustart des Pi's wieder festgestellt, dass die Rechte von /var/log wieder auf 644 sind.
Das ist erklärbar weil ich mit einem script "tmp2ram" unter anderem auch den Pfad /var/log ins Ram auslagere. Bei einem Neustart wird der Pfad also neu erstellt und hat wieder die Rechte 644. Könnte man über ein script beim Systemneustart nicht die rechte setzen "chmod 0755 /var/log" und wo müsste ich das hinpacken?

Gruß Rooki

Antworten