로그 회전을 어떻게 수행할 수 있나요? logrotate를 실행해도 아무런 효과가 없습니다.
root@me-Latitude-E5550:/etc/logrotate.d# cd ..
root@me-Latitude-E5550:/etc# cd ..
root@me-Latitude-E5550:/# logrotate -d /etc/logrotate.conf
Ignoring /etc/logrotate.conf because of bad file mode.
Handling 0 logs
root@me-Latitude-E5550:/# chmod 644 /etc/logrotate.d/*
root@me-Latitude-E5550:/# cd /etc/logrotate.d
root@me-Latitude-E5550:/etc/logrotate.d# ls
apport custom pm-utils speech-dispatcher upstart
apt dpkg ppp ufw
cups-daemon lightdm rsyslog unattended-upgrades
root@me-Latitude-E5550:/etc/logrotate.d# cd ..
root@me-Latitude-E5550:/etc# cd ..
root@me-Latitude-E5550:/# logrotate -d /etc/logrotate.conf
Ignoring /etc/logrotate.conf because of bad file mode.
Handling 0 logs
root@me-Latitude-E5550:/# cd /var/log
root@me-Latitude-E5550:/var/log# ls -larth
total 34M
drwxrwxrwx 2 root root 4,0K Feb 18 2016 speech-dispatcher
drwxrwxrwx 2 root root 4,0K Mai 19 2016 upstart
drwxrwxrwx 2 root root 4,0K Jul 19 2016 fsck
-rwxrwxrwx 1 root root 31 Jul 19 2016 dmesg
-rwxrwxrwx 1 root root 57K Jul 19 2016 bootstrap.log
drwxrwxrwx 3 root root 4,0K Jul 19 2016 hp
drwxr-xr-x 14 root root 4,0K Jul 19 2016 ..
drwxrwxrwx 2 root root 4,0K Jun 14 13:17 apt
drwxrwxrwx 2 root root 4,0K Jun 14 13:20 installer
drwxrwxrwx 2 root root 4,0K Jun 19 09:50 unattended-upgrades
-rwxrwxrwx 1 root root 3,8K Jun 19 09:55 fontconfig.log
-rwxrwxrwx 1 root root 554 Jun 19 15:02 apport.log.1
drwxrwxrwx 2 root root 4,0K Jun 20 07:35 lightdm
-rwxrwxrwx 1 root root 836K Jun 20 07:35 syslog.1
-rwxrwxrwx 1 root root 32K Jun 20 14:31 faillog
-rw------- 1 root utmp 768 Jul 14 09:28 btmp
drwxrwxrwx 2 root root 4,0K Jul 14 10:38 dist-upgrade
-rwxrwxrwx 1 root root 43K Jul 14 10:45 alternatives.log
-rwxrwxrwx 1 root root 286K Jul 14 11:04 lastlog
drwxrwxrwx 2 root root 4,0K Jul 18 08:59 sysstat
-rwxrwxrwx 1 root root 1,8M Jul 18 11:13 dpkg.log
drwxrwxrwx 2 root root 4,0K Jul 18 12:19 cups
-rw-r----- 1 root adm 14K Jul 18 12:20 apport.log
-rw-r--r-- 1 root root 32K Jul 18 18:38 Xorg.0.log.old
-rwxrwxrwx 1 root root 1,9K Jul 18 18:44 gpu-manager.log
-rw-r--r-- 1 root root 1009 Jul 18 18:44 boot.log
drwxrwxr-x 13 root syslog 4,0K Jul 18 18:44 .
-rw-rw-r-- 1 root utmp 85K Jul 18 18:45 wtmp
-rw-r--r-- 1 root root 29K Jul 18 21:17 Xorg.0.log
-rwxrwxrwx 1 root root 5,7M Jul 18 21:18 kern.log
-rwxrwxrwx 1 root root 580K Jul 18 21:50 auth.log
-rwxrwxrwx 1 root root 24M Jul 18 21:54 syslog
root@me-Latitude-E5550:/var/log# logrotate -f /etc/logroate.conf
error: cannot stat /etc/logroate.conf: No such file or directory
root@me-Latitude-E5550:/var/log# logrotate -f /etc/logrotate.conf
root@me-Latitude-E5550:/var/log# ls -larth
total 34M
drwxrwxrwx 2 root root 4,0K Feb 18 2016 speech-dispatcher
drwxrwxrwx 2 root root 4,0K Mai 19 2016 upstart
drwxrwxrwx 2 root root 4,0K Jul 19 2016 fsck
-rwxrwxrwx 1 root root 31 Jul 19 2016 dmesg
-rwxrwxrwx 1 root root 57K Jul 19 2016 bootstrap.log
drwxrwxrwx 3 root root 4,0K Jul 19 2016 hp
drwxr-xr-x 14 root root 4,0K Jul 19 2016 ..
drwxrwxrwx 2 root root 4,0K Jun 14 13:17 apt
drwxrwxrwx 2 root root 4,0K Jun 14 13:20 installer
drwxrwxrwx 2 root root 4,0K Jun 19 09:50 unattended-upgrades
-rwxrwxrwx 1 root root 3,8K Jun 19 09:55 fontconfig.log
-rwxrwxrwx 1 root root 554 Jun 19 15:02 apport.log.1
drwxrwxrwx 2 root root 4,0K Jun 20 07:35 lightdm
-rwxrwxrwx 1 root root 836K Jun 20 07:35 syslog.1
-rwxrwxrwx 1 root root 32K Jun 20 14:31 faillog
-rw------- 1 root utmp 768 Jul 14 09:28 btmp
drwxrwxrwx 2 root root 4,0K Jul 14 10:38 dist-upgrade
-rwxrwxrwx 1 root root 43K Jul 14 10:45 alternatives.log
-rwxrwxrwx 1 root root 286K Jul 14 11:04 lastlog
drwxrwxrwx 2 root root 4,0K Jul 18 08:59 sysstat
-rwxrwxrwx 1 root root 1,8M Jul 18 11:13 dpkg.log
drwxrwxrwx 2 root root 4,0K Jul 18 12:19 cups
-rw-r----- 1 root adm 14K Jul 18 12:20 apport.log
-rw-r--r-- 1 root root 32K Jul 18 18:38 Xorg.0.log.old
-rwxrwxrwx 1 root root 1,9K Jul 18 18:44 gpu-manager.log
-rw-r--r-- 1 root root 1009 Jul 18 18:44 boot.log
drwxrwxr-x 13 root syslog 4,0K Jul 18 18:44 .
-rw-rw-r-- 1 root utmp 85K Jul 18 18:45 wtmp
-rw-r--r-- 1 root root 29K Jul 18 21:17 Xorg.0.log
-rwxrwxrwx 1 root root 5,7M Jul 18 21:18 kern.log
-rwxrwxrwx 1 root root 580K Jul 18 21:50 auth.log
-rwxrwxrwx 1 root root 24M Jul 18 21:55 syslog
root@me-Latitude-E5550:/var/log#
답변1
logrotate.d의 권한을 변경하고 있습니다. 필요 chmod 644 /etc/logrotate.conf
하면 chown root:root /etc/logrotate.conf
작동할 것입니다.
답변2
logrotate.conf에 나열된 로그 파일이 존재하지 않을 때 이 오류가 발생하는 것을 발견했습니다. 이는 로그를 생성해야 하는 서비스가 실행되고 있지 않기 때문에 발생할 수 있습니다. 이러한 항목을 삭제하거나 관련 패키지를 삭제하십시오.