Configure different postrotate actions for logrotate for different GitLab components (nginx, sidekiq, etc)
Release notes
Problem: The current logrotate
configuration requires the same postrotate
action for all components managed by the logrotate
service embedded into GitLab.
Solution: Permit the administrator to configure different postrotate
actions for different components.
Problem to solve
It is possible to specify a postrotate
action for logrotate
. Today, each GitLab component (nginx
, puma
, gitlab-rails
, gitlab-workhorse
, etc) must use the same postrotate
action. Systems administrators may wish to configure different postrotate
actions for different components for increased flexibility.
Proposal
Permit per-component postrotate
actions for logrotate
for every component that logrotate
manages. It might make sense to use the value of logging['logrotate_postrotate']
as the default for a component unless there is a component-specific postrotate
action to override it.
Imagine:
logging['logrotate_postrotate'] = "date"
logging['logrotate_postrotate_nginx'] = "echo 'nginx restarted'"
logging['logrotate_postrotate_gitaly'] = "sh /usr/bin/post-rotate-gitaly-only"
The date
command would run as a postrotate
action for sidekiq
and all other components except nginx
and gitaly
.
Intended users
User experience goal
The system administrator should be able to configure different postrotate
actions for each GitLab component. This facilitates sending the rotated logs to services like OMSAgent FluentD.
Documentation
The docs about logrotate for omnibus would need to be updated to tell people how to make use of this feature.
Availability & Testing
This section needs to be retained and filled in during the workflow planning breakdown phase of this feature proposal, if not earlier.
What risks does this change pose to our availability? How might it affect the quality of the product? What additional test coverage or changes to tests will be needed? Will it require cross-browser testing?
Please list the test areas (unit, integration and end-to-end) that needs to be added or updated to ensure that this feature will work as intended. Please use the list below as guidance.
- Unit test changes
- Integration test changes
- End-to-end test change
See the test engineering planning process and reach out to your counterpart Software Engineer in Test for assistance: https://about.gitlab.com/handbook/engineering/quality/test-engineering/#test-planning
What does success look like, and how can we measure that?
It is possible to configure postrotate
action for logrotate
to be used for a specific GitLab component.