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

REST server: http log filtering and request read timeout #102

Merged
merged 4 commits into from
May 31, 2023

Conversation

sachinholla
Copy link
Contributor

1) Standard http library writes error and warning messages like "TLS handshake error" to staderr, which gets forwarded to syslog. It can flood the syslog during stress tests.

Added an error log writer to the REST http server to capture all such messages and filter out trivial messages. Only accept failures and handler panics are treated as non-trivial. All other messages are logged only if glog verbose level 2 is enabled.

Fixes the syslog flooding reported in sonic-net/sonic-buildimage#13576

2) Added a configurable 'read timeout' to REST server which is the deadline for reading a full http request (TLS+header+body) after a new connection is accepted. Connection is dropped if it was left idle for more than this duration or client takes longer to push the request. Default vale is 15s; can be changed via -readtimeout T command line flag. Value 0 disables this timeout.

1) Standard http library writes error and warning messages like "TLS
handshake error" to staderr, which gets forwarded to syslog.  It can
flood the syslog during stress tests.

Added an error log writer to the REST http server to capture all such
messages and filter out trivial messages. Only accept failures and
handler panics are treated as non-trivial. All other messages are
logged only if glog verbose level 2 is enabled.

2) Added a configurable 'read timeout' to REST server which is the
deadline for reading a full http request (TLS+header+body) after a new
connection is accepted. Connection is dropped if it was left idle for
more than this duration or client takes longer to push the request.
Default vale is 15s; can be changed via '-readtimeout T' command line
flag. Value 0 disables this timeout.
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 13, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: sachinholla / name: Sachin Holla (b4e1f95)

rest/main/main.go Show resolved Hide resolved
rest/main/main.go Show resolved Hide resolved
rest/main/main.go Outdated Show resolved Hide resolved
Copy link

@tomek-US tomek-US left a comment

Choose a reason for hiding this comment

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

LGTM

@anand-kumar-subramanian anand-kumar-subramanian merged commit c36f6e1 into sonic-net:master May 31, 2023
4 checks passed
@sachinholla sachinholla deleted the filter_http_log branch September 28, 2023 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants