Mailinglist Archive: opensuse (769 mails)

< Previous Next >
Re: [opensuse] logrotate not rotating my logs (openSUSE 13.2)
  • From: ianseeks <ianseeks@xxxxxxxxxxxxxx>
  • Date: Sat, 21 May 2016 10:25:46 +0100
  • Message-id: <2240152.Rz7Bn50WcB@lianli>
On Friday, 20 May 2016 17:13:42 BST Greg Freemyer wrote:
On Fri, May 20, 2016 at 4:58 PM, Patrick Shanahan <paka@xxxxxxxxxxxx> wrote:
* Greg Freemyer <greg.freemyer@xxxxxxxxx> [05-20-16 16:48]:
On Fri, May 20, 2016 at 4:28 PM, Patrick Shanahan <paka@xxxxxxxxxxxx>
wrote:
* Greg Freemyer <greg.freemyer@xxxxxxxxx> [05-20-16 16:19]:
My last rotated logs on this server are from 20160305

===

rpm -qa | grep log

syslog-service-2.0-778.3.1.noarch
rsyslog-8.4.2-3.1.x86_64
logrotate-3.8.7-6.1.2.x86_64
klogd-1.4.1-778.3.1.x86_64
liblogging0-1.0.4-2.1.3.x86_64
zypper-log-1.11.54-40.2.noarch
perl-Unix-Syslog-1.1-19.1.3.x86_64
===

Not sure how to troubleshoot this, so I'll wait for questions.

Logrotate maintains scripts:
/etc/logrotate.d/

called via cron: /etc/logrotate.conf

also

systemctl status logrotate

note that an unreadable log-file can cause rotation to fail. Not
likely
your problem unless you have a rotating rust problem :(

Strange:
systemctl status logrotate

logrotate.service - Rotate log files

Loaded: loaded (/usr/lib/systemd/system/logrotate.service; static)
Active: inactive (dead)

Docs: man:logrotate(8)

man:logrotate.conf(5)

So the systemd service isn't running. But when I try to enable it:

==================================

sudo systemctl enable logrotate

root's password:
The unit files have no [Install] section. They are not meant to be
enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another
unit's

.wants/ or .requires/ directory.

2) A unit's purpose may be to act as a helper for some other unit which
has

a requirement dependency on it.

3) A unit may be started when needed via activation (socket, path, timer,

D-Bus, udev, scripted systemctl call, ...).

===================================

Is it not supposed to be enabled?

Also, I did a " sudo systemctl start logrotate" and my logs are being
compressed now, but that won't survive a reboot.

Guess logrotate rpm doesn't contain the "service" files ?? or they didn't
get installed properly: /usr/lib/systemd/system/logrotate.service

Hmm....The service file says its a oneshot service. There is a
logrotate.timer file.

The problem must be that the timer isn't triggering. (Remember I can
run it manually).

=========================

sudo cat logrotate.timer

[Unit]
Description=Daily rotation of log files
Documentation=man:logrotate(8) man:logrotate.conf(5)

[Timer]
OnCalendar=daily
AccuracySec=12h
# not supported by our systemd (210) yet
#Persistent=true

[Install]
WantedBy=timers.target

=========================

cat 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
Nice=19
IOSchedulingClass=best-effort
IOSchedulingPriority=7
=========================

Greg

I'm on openSUSE Tumbleweed (20160519) (x86_64) and i thought i'd better check
mine was working.

I've just run "systemctl status logrotate" and "systemctl list-timers" and got
the following results without having to do anything.

sudo systemctl status logrotate
‚óŹ logrotate.service - Rotate log files
Loaded: loaded (/usr/lib/systemd/system/logrotate.service; static; vendor
preset: disabled)
Active: inactive (dead) since Sat 2016-05-21 10:01:49 BST; 13min ago
Docs: man:logrotate(8)
man:logrotate.conf(5)
Main PID: 1120 (code=exited, status=0/SUCCESS)

May 21 10:01:49 LianLi systemd[1]: Starting Rotate log files...
May 21 10:01:49 LianLi systemd[1]: Started Rotate log files.
May 21 10:01:49 LianLi logrotate[1120]: compress_ext is /usr/bin/xz
May 21 10:01:49 LianLi logrotate[1120]: compress_ext was changed to .xz
ians@LianLi:~> systemctl list-timers
NEXT LEFT LAST PASSED
UNIT ACTIVATES
Sun 2016-05-22 00:00:00 BST 13h left Sat 2016-05-21 10:01:49 BST 14min ago
logrotate.timer logrotate.service
Sun 2016-05-22 10:16:36 BST 23h left Sat 2016-05-21 10:16:36 BST 2s ago
systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service

2 timers listed.
Pass --all to see loaded but inactive timers, too.

:~> systemctl list-timers
NEXT LEFT LAST PASSED
UNIT ACTIVATES
Sun 2016-05-22 00:00:00 BST 13h left Sat 2016-05-21 10:01:49 BST 17min ago
logrotate.timer logrotate.service
Sun 2016-05-22 10:16:36 BST 23h left Sat 2016-05-21 10:16:36 BST 2min 35s
ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service

2 timers listed.
Pass --all to see loaded but inactive timers, too.



--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >