create rotate file on the fly for access.log - #9324
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #9324 +/- ##
============================================
- Coverage 17.57% 3.66% -13.91%
============================================
Files 5913 445 -5468
Lines 529428 38541 -490887
Branches 64677 7265 -57412
============================================
- Hits 93022 1413 -91609
+ Misses 425944 36961 -388983
+ Partials 10462 167 -10295
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
c300793 to
f0b45e5
Compare
f0b45e5 to
78a578f
Compare
78a578f to
ff27a44
Compare
|
Hi @DaanHoogland is this PR still in progress? |
|
@nvazquez , it just needs some validation, but should be ready. Outcome of validation might mean adjustment for different platforms, hence it is still in draft. |
There was a problem hiding this comment.
Pull request overview
This PR attempts to ensure the server’s access.log is rotated by generating a logrotate configuration file during embedded server startup (when the Jetty request log is created).
Changes:
- Adds runtime creation of a logrotate config targeting the configured access log file.
- Introduces filesystem write logic under
/etc/logrotate.dfromServerDaemon#createRequestLog().
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| try { | ||
| FileWriter fw = new FileWriter(rotateConfigFile); | ||
| fw.write(fileContents); | ||
| fw.close(); | ||
| } catch (IOException e) { | ||
| // log but continue without rotate (for now) | ||
| LOG.warn("no way to rotate access log, continuing as is"); | ||
| } |
| + " create 0644 cloud cloud" | ||
| + "}"; |
| private void createRotateFile(File logPath) { | ||
| String rotatefile = "/etc/logrotate.d/access"; | ||
| String fileContents = logPath.getAbsolutePath() + " {\n" |
Description
This PR...
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?