Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[System logs]: Eliminate duplicate log messages and attempt rotation more frequently #520

Merged
merged 14 commits into from
Apr 21, 2017
Merged

[System logs]: Eliminate duplicate log messages and attempt rotation more frequently #520

merged 14 commits into from
Apr 21, 2017

Conversation

jleveque
Copy link
Contributor

  • Implemented changes started by John Arnold last year
  • Fixed a few bugs
  • Increased frequency of log rotation from daily to once per minute

"teamsyncd",
"updategraph"]
then {
?SONiCPerProcessLogfile,SONiCFileFormat
Copy link
Contributor Author

@jleveque jleveque Apr 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to pull this for now, as it was incomplete. We can revisit it again in the future.

@lguohan
Copy link
Collaborator

lguohan commented Apr 20, 2017

@pavel-shirshov, can you review?

#
# m h dom mon dow command

* * * * * /usr/sbin/logrotate -f /etc/logrotate.d/rsyslog
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better put this as a file into /etc/cron.d/ ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. Done.

@@ -42,8 +42,8 @@ $UDPServerRun 514
#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

# Define a custom template
$template ACSFileFormat,"%TIMESTAMP% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n"
$ActionFileDefaultTemplate ACSFileFormat
$template SONiCFileFormat,"%TIMESTAMP% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add milliseconds into syslog output?

Copy link
Contributor Author

@jleveque jleveque Apr 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. it will work for me too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

#MaxLevelSyslog=debug
#MaxLevelKMsg=notice
#MaxLevelConsole=info
#MaxLevelWall=emerg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to comment all entries out of this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this?
Does SONiC emits all these types?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see

@@ -0,0 +1,44 @@
/var/log/syslog
/var/log/quagga/*.log
/var/log/sonic/*.log
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/var/log/sonic? Are we using this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not currently. Please see my first comment on 00-sonic.conf up above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it

@lguohan lguohan merged commit 6c20291 into sonic-net:master Apr 21, 2017
@jleveque jleveque deleted the syslog_improvements branch April 21, 2017 18:14
daall added a commit to daall/sonic-buildimage that referenced this pull request Nov 19, 2019
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>
lguohan pushed a commit that referenced this pull request Nov 21, 2019
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>
zhenggen-xu pushed a commit to zhenggen-xu/sonic-buildimage that referenced this pull request Jan 10, 2020
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>
madhanmellanox pushed a commit to madhanmellanox/sonic-buildimage that referenced this pull request Mar 23, 2020
dmytroxshevchuk pushed a commit to dmytroxshevchuk/sonic-buildimage that referenced this pull request Aug 31, 2020
* 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
Pterosaur added a commit to Pterosaur/sonic-buildimage that referenced this pull request Nov 8, 2021
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>
Pterosaur added a commit that referenced this pull request Nov 9, 2021
52b7a47 (HEAD, origin/master, origin/HEAD) [schema]: MACsec statistics support (#520)
48d7d8a [ci]: use native arm64 and armhf pool to build (#552)

Signed-off-by: Ze Gan <ganze718@gmail.com>
mssonicbld added a commit that referenced this pull request Jul 19, 2024
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants