-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from mariux64/add-logrotate
Add logrotate configuration to rotate /var/log/messages
- Loading branch information
Showing
4 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/var/log/messages { | ||
dateext | ||
dateformat .%Y-%m | ||
dateyesterday | ||
rotate 12 | ||
monthly | ||
sharedscripts | ||
postrotate | ||
kill -HUP $(cat /var/run/rsyslogd.pid) | ||
endscript | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[Unit] | ||
Description=Rotate log files | ||
Documentation=man:logrotate(8) man:logrotate.conf(5) | ||
RequiresMountsFor=/var/log | ||
ConditionACPower=true | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/sbin/logrotate -v /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 | ||
MemoryDenyWriteExecute=true | ||
PrivateDevices=true | ||
PrivateTmp=true | ||
ProtectControlGroups=true | ||
ProtectKernelModules=true | ||
ProtectSystem=full | ||
RestrictRealtime=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Unit] | ||
Description=Daily rotation of log files | ||
Documentation=man:logrotate(8) man:logrotate.conf(5) | ||
|
||
[Timer] | ||
OnCalendar=daily | ||
AccuracySec=1h | ||
Persistent=true | ||
|
||
[Install] | ||
WantedBy=timers.target |