[System logs]: Eliminate duplicate log messages and attempt rotation more frequently#520
[System logs]: Eliminate duplicate log messages and attempt rotation more frequently#520lguohan merged 14 commits intosonic-net:masterfrom jleveque:syslog_improvements
Conversation
jleveque
commented
Apr 20, 2017
- Implemented changes started by John Arnold last year
- Fixed a few bugs
- Increased frequency of log rotation from daily to once per minute
There was a problem hiding this comment.
Per-process SONiC logging is not currently working. I don't think John finished this. I updated the list of programs, just in case we want it working, but I believe we'd just like everything to log to /var/log/syslog. If so, I will remove this. Please share your thoughts.
There was a problem hiding this comment.
I decided to pull this for now, as it was incomplete. We can revisit it again in the future.
…logging to /var/log/messages
… to /var/log/syslog
…names to SONiC rules clause
…dy-rotated logs (e.g., bgpd.log.1.1.1.1.1...)
|
@pavel-shirshov, can you review? |
files/image_config/cron/crontab
Outdated
There was a problem hiding this comment.
Better put this as a file into /etc/cron.d/ ?
There was a problem hiding this comment.
The current directory structure of files/image_config is not set to mirror the structure of /etc on the SONiC image. If we want to do this for crontab, we should rearrange everything into the /etc/... hierarchy to make things clear across the board.
Also, with our Debian distribution, crontab lives directly in /etc, not in /etc/cron.d.
There was a problem hiding this comment.
What I see in SONiC
$ ls /etc/cron*
/etc/crontab
/etc/cron.d:
/etc/cron.daily:
apt bsdmainutils dpkg logrotate ntp passwd
/etc/cron.hourly:
/etc/cron.monthly:
/etc/cron.weekly:
Can we put a file to /etc/cron.d/ directory?
There was a problem hiding this comment.
Can we add milliseconds into syslog output?
There was a problem hiding this comment.
Unfortunately, from my research, it appears rsyslog doesn't provide granularity of milliseconds. It only provides "subseconds" which are, in fact, microseconds. Do we want microsecond granularity? If so, I'll add this. The format would appear as follows:
Apr 20 23:30:01.827792 str-s6000-acs-12 INFO CRON[12536]: (root) CMD (/usr/sbin/logrotate -f /etc/logrotate.d/rsyslog)
Apr 20 23:30:41.652233 str-s6000-acs-12 INFO database.sh[1728]: 1:M 20 Apr 23:30:41.651 * 10000 changes in 60 seconds. Saving...
Apr 20 23:30:41.655740 str-s6000-acs-12 INFO database.sh[1728]: 1:M 20 Apr 23:30:41.654 * Background saving started by pid 84
Apr 20 23:30:41.975609 str-s6000-acs-12 INFO database.sh[1728]: 84:C 20 Apr 23:30:41.974 * DB saved on disk
Apr 20 23:30:41.981183 str-s6000-acs-12 INFO database.sh[1728]: 84:C 20 Apr 23:30:41.980 * RDB: 1 MB of memory used by copy-on-write
Apr 20 23:30:42.057539 str-s6000-acs-12 INFO database.sh[1728]: 1:M 20 Apr 23:30:42.056 * Background saving terminated with success
Apr 20 23:30:48.0 str-s6000-acs-12 ALERT sensord: Sensor alarm: Chip ltc4215-i2c-11-42: in1: +11.33 V [ALARM]
Apr 20 23:31:01.856022 str-s6000-acs-12 INFO CRON[12599]: (root) CMD (/usr/sbin/logrotate -f /etc/logrotate.d/rsyslog)
There was a problem hiding this comment.
Yes. it will work for me too.
| #MaxLevelSyslog=debug | ||
| #MaxLevelKMsg=notice | ||
| #MaxLevelConsole=info | ||
| #MaxLevelWall=emerg |
There was a problem hiding this comment.
Why do we need to comment all entries out of this file?
There was a problem hiding this comment.
This is how John originally added the file. He only intended to take advantage of SystemMaxUse and RuntimeMaxUse. We can define other variables if we'd like.
There was a problem hiding this comment.
I'm good with this. Thanks
| kern.* -/var/log/kern.log | ||
| kern.* -/var/persist/log/kern.log | ||
| lpr.* -/var/log/lpr.log | ||
| # Do not redirect cron, daemon, kernel or lpr logs to |
There was a problem hiding this comment.
Do we really need this?
Does SONiC emits all these types?
There was a problem hiding this comment.
The *.* on line 5 catches all messages and logs them to /var/log/syslog. Then, all messages that match cron.*, daemon.* etc. are logged again to their respective files. I commented out the individual files so that all messages are only logged once, to /var/log/syslog.
| @@ -0,0 +1,44 @@ | |||
| /var/log/syslog | |||
| /var/log/quagga/*.log | |||
| /var/log/sonic/*.log | |||
There was a problem hiding this comment.
/var/log/sonic? Are we using this?
There was a problem hiding this comment.
Not currently. Please see my first comment on 00-sonic.conf up above.
… crontab file into /etc/cron.d
sairedis: * [SAI] Update SAI submodule to v1.5.1 (sonic-net#532) * Cleanup Makefile.am from BFN specific code (sonic-net#530) * [vs] Implement indices for debug counters in VS (sonic-net#531) * Enable FastReboot if we have key "FAST_REBOOT|system" in State db (sonic-net#529) * [flex_counter] Add sairedis support for drop counters (sonic-net#520) swss: * [orchagent] Add swss support for drop counters (sonic-net#1075) * [orchagent] warning fixes for 32bit arch compilation (sonic-net#1129) * [utilities] Create utility classes for interacting with flex counters (sonic-net#1093) * [portsorch] add support to set mac-address learning attribute on bridge-port (sonic-net#809) * Fix traceroute issue (sonic-net#1113) utilities: * Add CLI support for configurable drop counters (sonic-net#688) * Revert "SONiC Management Framework Release 1.0 (sonic-net#659)" (sonic-net#741) * SONiC Management Framework Release 1.0 (sonic-net#659) Signed-off-by: Danny Allen <daall@microsoft.com>
sairedis: * [SAI] Update SAI submodule to v1.5.1 (#532) * Cleanup Makefile.am from BFN specific code (#530) * [vs] Implement indices for debug counters in VS (#531) * Enable FastReboot if we have key "FAST_REBOOT|system" in State db (#529) * [flex_counter] Add sairedis support for drop counters (#520) swss: * [orchagent] Add swss support for drop counters (#1075) * [orchagent] warning fixes for 32bit arch compilation (#1129) * [utilities] Create utility classes for interacting with flex counters (#1093) * [portsorch] add support to set mac-address learning attribute on bridge-port (#809) * Fix traceroute issue (#1113) utilities: * Add CLI support for configurable drop counters (#688) * Revert "SONiC Management Framework Release 1.0 (#659)" (#741) * SONiC Management Framework Release 1.0 (#659) Signed-off-by: Danny Allen <daall@microsoft.com>
sairedis: * [SAI] Update SAI submodule to v1.5.1 (sonic-net#532) * Cleanup Makefile.am from BFN specific code (sonic-net#530) * [vs] Implement indices for debug counters in VS (sonic-net#531) * Enable FastReboot if we have key "FAST_REBOOT|system" in State db (sonic-net#529) * [flex_counter] Add sairedis support for drop counters (sonic-net#520) swss: * [orchagent] Add swss support for drop counters (sonic-net#1075) * [orchagent] warning fixes for 32bit arch compilation (sonic-net#1129) * [utilities] Create utility classes for interacting with flex counters (sonic-net#1093) * [portsorch] add support to set mac-address learning attribute on bridge-port (sonic-net#809) * Fix traceroute issue (sonic-net#1113) utilities: * Add CLI support for configurable drop counters (sonic-net#688) * Revert "SONiC Management Framework Release 1.0 (sonic-net#659)" (sonic-net#741) * SONiC Management Framework Release 1.0 (sonic-net#659) Signed-off-by: Danny Allen <daall@microsoft.com>
* Adds functions to syncd_flex_counter for configuring and polling port-level debug counters Signed-off-by: Danny Allen daall@microsoft.com * Remove uneccesary includes * Add stubs for querying sai capabilities * Add support for serializing debug counter attributes * Add support for switch level debug counters * Improve vslib support for debug counters * Remove interface query stubs * Add missing swss log * Clean-up virtual switch implementation * Simplify vs debug counters * Remove unnecessary includes * Fix formatting * Respond to review comments
52b7a47 (HEAD, origin/master, origin/HEAD) [schema]: MACsec statistics support (sonic-net#520) 48d7d8a [ci]: use native arm64 and armhf pool to build (sonic-net#552) Signed-off-by: Ze Gan <ganze718@gmail.com>
…D automatically (#19629) #### Why I did it src/sonic-platform-daemons ``` * 5bbe6d6 - (HEAD -> 202311, origin/202311) [ycabled][active-active] Fix in gRPC channel callback logic by creating swsscommon table within the context (#509) (9 minutes ago) [vdahiya12] * 12aede7 - Initialize application specific fields as 'N/A' in TRANSCEIVER_INFO table (#511) (#520) (4 hours ago) [mssonicbld] ``` #### How I did it #### How to verify it #### Description for the changelog
Why I did it Release Content Cisco-8800 Chassis: Fixed appdemo process crash. Fixed BFD ACL rule generation for internal portchannels using production graph. Signed-off-by: Anand Mehra anamehra@cisco.com
…lly (#24314) #### Why I did it src/sonic-gnmi ``` * 072f3a4 - (HEAD -> master, origin/master, origin/HEAD) gNOI file remove: add handler & tests; update builder and main (#520) (28 hours ago) [ravaliyel] * d79245b - Implements complete firmware file listing through gNMI interface with… (#523) (29 hours ago) [v-cshekar] ``` #### How I did it #### How to verify it #### Description for the changelog
…lly (sonic-net#24314) #### Why I did it src/sonic-gnmi ``` * 072f3a4 - (HEAD -> master, origin/master, origin/HEAD) gNOI file remove: add handler & tests; update builder and main (sonic-net#520) (28 hours ago) [ravaliyel] * d79245b - Implements complete firmware file listing through gNMI interface with… (sonic-net#523) (29 hours ago) [v-cshekar] ``` #### How I did it #### How to verify it #### Description for the changelog Signed-off-by: Feng Pan <fenpan@microsoft.com>
…tomatically (sonic-net#24612) #### Why I did it src/sonic-linux-kernel ``` * b451639 - (HEAD -> master, origin/master, origin/HEAD) PCIe AER printk ratelimiting backport (sonic-net#520) (2 weeks ago) [jamessewart-arista] ``` #### How I did it #### How to verify it #### Description for the changelog Signed-off-by: Dawei Huang <daweihuang@microsoft.com>
…tomatically (sonic-net#24612) #### Why I did it src/sonic-linux-kernel ``` * b451639 - (HEAD -> master, origin/master, origin/HEAD) PCIe AER printk ratelimiting backport (sonic-net#520) (2 weeks ago) [jamessewart-arista] ``` #### How I did it #### How to verify it #### Description for the changelog Signed-off-by: xiaweijiang <xiaweijiang@microsoft.com>
…tomatically (sonic-net#24612) #### Why I did it src/sonic-linux-kernel ``` * b451639 - (HEAD -> master, origin/master, origin/HEAD) PCIe AER printk ratelimiting backport (sonic-net#520) (2 weeks ago) [jamessewart-arista] ``` #### How I did it #### How to verify it #### Description for the changelog
…tomatically (sonic-net#24612) #### Why I did it src/sonic-linux-kernel ``` * b451639 - (HEAD -> master, origin/master, origin/HEAD) PCIe AER printk ratelimiting backport (sonic-net#520) (2 weeks ago) [jamessewart-arista] ``` #### How I did it #### How to verify it #### Description for the changelog Signed-off-by: Feng Pan <fenpan@microsoft.com>
…tomatically (#24612) #### Why I did it src/sonic-linux-kernel ``` * b451639 - (HEAD -> master, origin/master, origin/HEAD) PCIe AER printk ratelimiting backport (#520) (2 weeks ago) [jamessewart-arista] ``` #### How I did it #### How to verify it #### Description for the changelog Signed-off-by: dprital <drorp@nvidia.com>