Logrotate.service failed - syslog и boot.log not getting populated - Ubuntu Server 20.04

Получил новый сервер и вчера установил на него Ubuntu server 20.04. Вчера все работало нормально. Выключил сервер ночью и запустил его сегодня.

Обнаружил, что syslog и boot.log пустые.

systemctl list-units --state=failed
  UNIT              LOAD   ACTIVE SUB    DESCRIPTION     
● logrotate.service loaded failed failed Rotate log files

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

1 loaded units listed.

Проверил статус logrotate.service.

systemctl status logrotate.service
● logrotate.service - Rotate log files
     Loaded: loaded (/lib/systemd/system/logrotate.service; static; vendor preset: enabled)
     Active: failed (Result: exit-code) since Thu 2021-06-03 15:14:08 IST; 20min ago
TriggeredBy: ● logrotate.timer
       Docs: man:logrotate(8)
             man:logrotate.conf(5)
    Process: 1070 ExecStart=/usr/sbin/logrotate /etc/logrotate.conf (code=exited, status=1/FAILURE)
   Main PID: 1070 (code=exited, status=1/FAILURE)

Warning: some journal files were not opened due to insufficient permissions.

Проверил файл logrotate.conf

cat logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly

# use the adm group by default, since this is the owning group
# of /var/log/syslog.
su root adm

# keep 4 weeks worth of backlogs
rotate 4

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

# use date as a suffix of the rotated file
#dateext

# uncomment this if you want your log files compressed
#compress

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

# system-specific logs may be also be configured here.

Перезапустил logrotate.service

    systemctl restart logrotate.service
systemctl status logrotate              
● logrotate.service - Rotate log files
     Loaded: loaded (/lib/systemd/system/logrotate.service; static; vendor preset: enabled)
     Active: inactive (dead) since Thu 2021-06-03 16:02:57 IST; 47s ago
TriggeredBy: ● logrotate.timer
       Docs: man:logrotate(8)
             man:logrotate.conf(5)
    Process: 16162 ExecStart=/usr/sbin/logrotate /etc/logrotate.conf (code=exited, status=0/SUCCESS)
   Main PID: 16162 (code=exited, status=0/SUCCESS)

Это logrotate.service

systemctl cat logrotate.service         
# /lib/systemd/system/logrotate.service
[Unit]
Description=Rotate log files
Documentation=man:logrotate(8) man:logrotate.conf(5)
ConditionACPower=true

[Service]
Type=oneshot
ExecStart=/usr/sbin/logrotate /etc/logrotate.conf

# performance options
Nice=19
IOSchedulingClass=best-effort
IOSchedulingPriority=7

# hardening options
#  details: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
#  no ProtectHome for userdir logs
#  no PrivateNetwork for mail deliviery
#  no ProtectKernelTunables for working SELinux with systemd older than 235
#  no MemoryDenyWriteExecute for gzip on i686
PrivateDevices=true
PrivateTmp=true
ProtectControlGroups=true
ProtectKernelModules=true
ProtectSystem=full
RestrictRealtime=true

Но все равно syslog и boot.log пусты.

Любая помощь по этому вопросу будет очень полезна.

Заранее спасибо.

1
задан 3 June 2021 в 15:22

1 ответ

В вашем logrotate.conf строка "su root adm" неверна.

Прочитайте man logrotate.conf и измените строку на «adm». Это имя группы, а не команда.

0
ответ дан 28 July 2021 в 11:33

Другие вопросы по тегам:

Похожие вопросы: