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

Use logrotate to rotate OVS log files #1329

Merged
merged 1 commit into from
Oct 3, 2020

Conversation

jianjuns
Copy link
Contributor

@jianjuns jianjuns commented Oct 1, 2020

Install logrotate in the OVS Docker image.
Enhance start_ovs to run logrotate against the OVS log files in
/var/log/openvswitch/ every hour, with two flags:
--log_file_max_num and --log_file_max_size to specify the maximum
number and maximum size of log files respectively.
Update the Antrea deployment YAMLs to set the default value of
--log_file_max_num to 4, and the default value of --log_file_max_size
to 100MB.

Fixes: #1328

@antrea-bot
Copy link
Collaborator

Thanks for your PR.
Unit tests and code linters are run automatically every time the PR is updated.
E2e, conformance and network policy tests can only be triggered by a member of the vmware-tanzu organization. Regular contributors to the project should join the org.

The following commands are available:

  • /test-e2e: to trigger e2e tests.
  • /skip-e2e: to skip e2e tests.
  • /test-conformance: to trigger conformance tests.
  • /skip-conformance: to skip conformance tests.
  • /test-whole-conformance: to trigger all conformance tests on linux.
  • /skip-whole-conformance: to skip all conformance tests on linux.
  • /test-networkpolicy: to trigger networkpolicy tests.
  • /skip-networkpolicy: to skip networkpolicy tests.
  • /test-windows-conformance: to trigger windows conformance tests.
  • /skip-windows-conformance: to skip windows conformance tests.
  • /test-windows-networkpolicy: to trigger windows networkpolicy tests.
  • /skip-windows-networkpolicy: to skip windows networkpolicy tests.
  • /test-hw-offload: to trigger ovs hardware offload test.
  • /skip-hw-offload: to skip ovs hardware offload test.
  • /test-all: to trigger all tests (except whole conformance).
  • /skip-all: to skip all tests (except whole conformance).

@jianjuns jianjuns requested a review from antoninbas October 1, 2020 06:03
@codecov-commenter
Copy link

codecov-commenter commented Oct 1, 2020

Codecov Report

Merging #1329 into master will decrease coverage by 0.21%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1329      +/-   ##
==========================================
- Coverage   64.60%   64.39%   -0.22%     
==========================================
  Files         157      157              
  Lines       12626    12626              
==========================================
- Hits         8157     8130      -27     
- Misses       3622     3645      +23     
- Partials      847      851       +4     
Flag Coverage Δ
#integration-tests 44.76% <ø> (-0.04%) ⬇️
#kind-e2e-tests 50.01% <ø> (-0.69%) ⬇️
#unit-tests 42.18% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ver/registry/controlplane/nodestatssummary/rest.go 50.00% <0.00%> (-50.00%) ⬇️
pkg/controller/networkpolicy/tier.go 90.00% <0.00%> (-10.00%) ⬇️
pkg/apis/controlplane/v1beta1/sets.go 36.76% <0.00%> (-7.36%) ⬇️
pkg/agent/stats/collector.go 91.95% <0.00%> (-5.75%) ⬇️
...ntroller/networkpolicy/networkpolicy_controller.go 69.96% <0.00%> (-3.56%) ⬇️
...kg/controller/networkpolicy/store/networkpolicy.go 77.96% <0.00%> (-3.39%) ⬇️
pkg/ovs/openflow/ofctrl_bridge.go 70.35% <0.00%> (-0.80%) ⬇️
...ntroller/networkpolicy/networkpolicy_controller.go 80.69% <0.00%> (-0.14%) ⬇️
pkg/apiserver/storage/ram/store.go 80.45% <0.00%> (+1.50%) ⬆️

antoninbas
antoninbas previously approved these changes Oct 2, 2020
Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

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

LGTM. Let me know when you want me to manually update the OVS base image in Dockerhub so you can trigger the tests.

Comment on lines 41 to 47
-*|--*) # unsupported flags
echo "Error: unsupported flag $1" >&2
exit 128
;;
*) # standalone arguments are not supported
echo "Error: unsupported argument $1" >&2
exit 128
Copy link
Contributor

Choose a reason for hiding this comment

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

curious about the choice of 128 as the exit code? aren't exit code > 127 typically used for specific purposes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually forgot to change it. Just changed to 1.

Install logrotate in the OVS Docker image.
Enhance start_ovs to run logrotate against the OVS log files in
/var/log/openvswitch/ every hour, with two flags:
--log_file_max_num and --log_file_max_size to specify the maximum
number and maximum size of log files respectively.
Update the Antrea deployment YAMLs to set the default value of
--log_file_max_num to 4, and the default value of --log_file_max_size
to 100MB.
@jianjuns
Copy link
Contributor Author

jianjuns commented Oct 2, 2020

LGTM. Let me know when you want me to manually update the OVS base image in Dockerhub so you can trigger the tests.

@antoninbas : please help update the OVS image.

Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

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

LGTM

Uploaded updated images to Dockerhub. They will be overwritten again in 5 hours.

@antoninbas
Copy link
Contributor

/test-all

@jianjuns jianjuns merged commit cc49ad7 into antrea-io:master Oct 3, 2020
antoninbas pushed a commit to antoninbas/antrea that referenced this pull request Nov 10, 2020
Install logrotate in the OVS Docker image.
Enhance start_ovs to run logrotate against the OVS log files in
/var/log/openvswitch/ every hour, with two flags:
--log_file_max_num and --log_file_max_size to specify the maximum
number and maximum size of log files respectively.
Update the Antrea deployment YAMLs to set the default value of
--log_file_max_num to 4, and the default value of --log_file_max_size
to 100MB.
antoninbas pushed a commit that referenced this pull request Nov 11, 2020
Install logrotate in the OVS Docker image.
Enhance start_ovs to run logrotate against the OVS log files in
/var/log/openvswitch/ every hour, with two flags:
--log_file_max_num and --log_file_max_size to specify the maximum
number and maximum size of log files respectively.
Update the Antrea deployment YAMLs to set the default value of
--log_file_max_num to 4, and the default value of --log_file_max_size
to 100MB.
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.

Rotate and limit size of OVS logs
5 participants