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

Add gateway log rotatation #2988

Merged
merged 1 commit into from
Jul 19, 2023

Conversation

s-fairchild
Copy link
Collaborator

@s-fairchild s-fairchild commented Jun 26, 2023

Which issue this PR addresses:

Fixes

Improved fix for https://portal.microsofticm.com/imp/v3/incidents/details/399550776/home

What this PR does / why we need it:

The gateway container log is mounted in /var/log/aro-gateway to allow logrotate access to the file. Logs are rotated based on size, not time. Logs are rotated when they reach 20G in size, and a maximum of 100G total. This is to allow enough space for other logs and system services in /var.

copytruncate option prevents the log file from being recreated after being deleted, which would create a condition where the log watcher/shipper thinks they are new.copytruncate truncates the log file, leaving it's modification timestamp the same.

Test plan for issue:

E2E tests, and I believe a full service RP will be required to actually test.
sshing into the gateway VMSS and testing the logrotate configuration manually.

Is there any documentation that needs to be updated for this PR?

No

pkg/deploy/generator/scripts/gatewayVMSS.sh Show resolved Hide resolved
pkg/deploy/generator/scripts/gatewayVMSS.sh Show resolved Hide resolved
pkg/deploy/generator/scripts/gatewayVMSS.sh Outdated Show resolved Hide resolved
@s-fairchild s-fairchild force-pushed the gateway-log-rotate branch 4 times, most recently from e2ea971 to bb81733 Compare June 28, 2023 14:39
Copy link
Contributor

@s-amann s-amann left a comment

Choose a reason for hiding this comment

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

@s-fairchild I believe you need to re-run make generate and commit/push the results in order for CI to pass.

Copy link
Collaborator

@cadenmarchese cadenmarchese left a comment

Choose a reason for hiding this comment

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

I went through the logrotate options and things are making sense, just a few comments. Thanks!

pkg/deploy/generator/scripts/gatewayVMSS.sh Outdated Show resolved Hide resolved
pkg/deploy/generator/scripts/gatewayVMSS.sh Outdated Show resolved Hide resolved
pkg/deploy/generator/scripts/gatewayVMSS.sh Show resolved Hide resolved
@@ -67,6 +72,18 @@ include /etc/logrotate.d
create 0600 root utmp
rotate 1
}

# Maximum log directory size is 100G with this configuration
# Setting limit to 100G to allow space for other logging services
Copy link
Contributor

Choose a reason for hiding this comment

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

please update this comment to match the size on line 80

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The comment is correct, it's a multiple of size and rotate options. 5 logs of size 20G will be kept.

@github-actions
Copy link

github-actions bot commented Jul 7, 2023

Please rebase pull request.

@github-actions github-actions bot added the needs-rebase branch needs a rebase label Jul 7, 2023
@github-actions github-actions bot removed the needs-rebase branch needs a rebase label Jul 10, 2023
@github-actions github-actions bot added the needs-rebase branch needs a rebase label Jul 13, 2023
@github-actions
Copy link

Please rebase pull request.

@cadenmarchese cadenmarchese added the chainsaw Pull requests or issues owned by Team Chainsaw label Jul 17, 2023
The gateway container log is mounted in /var/log/aro-gateway to allow logrotate access to the file.
Logs are rotated based on size, not time. Logs are rotated when they reach 20G in size, and a maximum of 100G total.
This is to allow enough space for other logs and system services in /var.

copytruncate option prevents the log file from being recreated after being deleted, which would create a condition where the log watcher/shipper thinks they are new.
copytruncate truncates the log file, leaving it's modification timestamp the same.
@cadenmarchese cadenmarchese dismissed facchettos’s stale review July 19, 2023 12:19

All comments addressed

@cadenmarchese cadenmarchese merged commit 92c892e into Azure:master Jul 19, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chainsaw Pull requests or issues owned by Team Chainsaw ready-for-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants