-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[System logs]: Eliminate duplicate log messages and attempt rotation …
…more frequently (#520) * Rename 'ACSFileFormat' -> 'SONiCFileFormat' * Rename '00-acs.conf' -> '00-sonic.conf' * Add logrotate.d and systemd-journald config files to image * Log all SONiC process messages to /var/log/syslog; prevent duplicate logging to /var/log/messages * Do not redirect cron and daemon logs to their own files, let them log to /var/log/syslog * Log all teamd messages to /var/log/teamd.log; Add more SONiC program names to SONiC rules clause * Remove duplicate code by condensing quagga programs into a list; Fix teamd log rule * Kernel and LPR messages no longer getting duplicated to their own log files * Now calling logrotate every minute via cron job * Need full path to logrotate in cron job * Add '.log' suffix to wildcards, otherwise logrotate will rotate already-rotated logs (e.g., bgpd.log.1.1.1.1.1...) * Add microsecond granularity to syslog messages * Don't overwrite system crontab, instead, install additional logrotate crontab file into /etc/cron.d * Removed incomplete concept of per-process SONiC logs. We can revisit again later
- Loading branch information
Showing
10 changed files
with
133 additions
and
61 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
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,3 @@ | ||
# Attempt to rotate system logs once per minute | ||
* * * * * root /usr/sbin/logrotate -f /etc/logrotate.d/rsyslog | ||
|
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,43 @@ | ||
/var/log/syslog | ||
/var/log/quagga/*.log | ||
/var/log/teamd.log | ||
{ | ||
rotate 7 | ||
# Removed 'daily' interval, as we now call logrotate more frequently via cron | ||
# and we want to check these logs every time | ||
# daily | ||
size 100M | ||
missingok | ||
notifempty | ||
compress | ||
delaycompress | ||
postrotate | ||
invoke-rc.d rsyslog rotate > /dev/null | ||
endscript | ||
} | ||
/var/log/mail.info | ||
/var/log/mail.warn | ||
/var/log/mail.err | ||
/var/log/mail.log | ||
/var/log/daemon.log | ||
/var/log/kern.log | ||
/var/log/auth.log | ||
/var/log/user.log | ||
/var/log/lpr.log | ||
/var/log/cron.log | ||
/var/log/debug | ||
/var/log/messages | ||
{ | ||
rotate 4 | ||
weekly | ||
size 100M | ||
missingok | ||
notifempty | ||
compress | ||
delaycompress | ||
sharedscripts | ||
postrotate | ||
invoke-rc.d rsyslog rotate > /dev/null | ||
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
This file was deleted.
Oops, something went wrong.
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,22 @@ | ||
## Quagga rules | ||
|
||
if $programname == ["quagga", | ||
"watchquagga", | ||
"zebra"] | ||
then { | ||
/var/log/quagga/zebra.log | ||
stop | ||
} | ||
|
||
if $programname == "bgpd" then { | ||
/var/log/quagga/bgpd.log | ||
stop | ||
} | ||
|
||
## Teamd rules | ||
|
||
if $programname contains "teamd_" then { | ||
/var/log/teamd.log | ||
stop | ||
} | ||
|
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,36 @@ | ||
# This file is part of systemd. | ||
# | ||
# systemd is free software; you can redistribute it and/or modify it | ||
# under the terms of the GNU Lesser General Public License as published by | ||
# the Free Software Foundation; either version 2.1 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# See journald.conf(5) for details | ||
|
||
[Journal] | ||
#Storage=auto | ||
#Compress=yes | ||
#Seal=yes | ||
#SplitMode=uid | ||
#SyncIntervalSec=5m | ||
#RateLimitInterval=30s | ||
#RateLimitBurst=1000 | ||
SystemMaxUse=50MB | ||
#SystemKeepFree= | ||
#SystemMaxFileSize= | ||
RuntimeMaxUse=50MB | ||
#RuntimeKeepFree= | ||
#RuntimeMaxFileSize= | ||
#MaxRetentionSec= | ||
#MaxFileSec=1month | ||
#ForwardToSyslog=yes | ||
#ForwardToKMsg=no | ||
#ForwardToConsole=no | ||
#ForwardToWall=yes | ||
#TTYPath=/dev/console | ||
#MaxLevelStore=debug | ||
#MaxLevelSyslog=debug | ||
#MaxLevelKMsg=notice | ||
#MaxLevelConsole=info | ||
#MaxLevelWall=emerg | ||
|
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