chore(audit-log): add audit log file transport configurable via appli…#6377
chore(audit-log): add audit log file transport configurable via appli…#6377corinnekrych wants to merge 1 commit into
Conversation
…cation.properties
There was a problem hiding this comment.
Pull request overview
This PR makes the audit log file transport configurable via Spring application.properties by wiring audit-log path/name and rolling-policy settings into logback-spring.xml.
Changes:
- Read audit log file settings from
openaev.audit-logs.file.*Spring properties. - Switch audit log rolling from time-based to size-and-time-based rolling, with configurable limits.
- Add new
openaev.audit-logs.file.*andopenaev.audit-logs.engine.*configuration keys toapplication.properties.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| openaev-api/src/main/resources/logback-spring.xml | Loads audit file transport settings from Spring properties and updates rolling policy to size+time-based rollover. |
| openaev-api/src/main/resources/application.properties | Defines new audit-log configuration keys for file and engine transports. |
| <!-- Audit log file path and name from Spring properties --> | ||
| <springProperty scope="context" name="AUDIT_LOG_DIR" source="openaev.audit-logs.file.dir" defaultValue="logs" /> | ||
| <springProperty scope="context" name="AUDIT_LOG_FILENAME" source="openaev.audit-logs.file.filename" defaultValue="audit.log" /> | ||
| <springProperty scope="context" name="AUDIT_LOG_ROLLOVER_MAX_SIZE" source="openaev.audit-logs.file.rollover-max-size" defaultValue="10MB" /> | ||
| <springProperty scope="context" name="AUDIT_LOG_RETENTION_DAYS" source="openaev.audit-logs.file.retention-days" defaultValue="90" /> | ||
| <springProperty scope="context" name="AUDIT_LOG_ROLLOVER_TOTAL_SIZE_CAP" source="openaev.audit-logs.file.rollover-total-size-cap" defaultValue="1GB" /> | ||
| <property name="AUDIT_LOG_FILE" value="${AUDIT_LOG_DIR}/${AUDIT_LOG_FILENAME}" /> |
| <maxHistory>90</maxHistory> | ||
| <totalSizeCap>1GB</totalSizeCap> | ||
| <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | ||
| <fileNamePattern>${AUDIT_LOG_DIR}/${AUDIT_LOG_FILENAME}.%d{yyyy-MM-dd}.%i</fileNamePattern> |
| <maxHistory>90</maxHistory> | ||
| <totalSizeCap>1GB</totalSizeCap> | ||
| <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | ||
| <fileNamePattern>${AUDIT_LOG_DIR}/${AUDIT_LOG_FILENAME}.%d{yyyy-MM-dd}.%i</fileNamePattern> |
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project check has failed because the head coverage (2.96%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #6377 +/- ##
============================================
+ Coverage 43.41% 43.50% +0.09%
- Complexity 6924 6959 +35
============================================
Files 2249 2252 +3
Lines 61898 62027 +129
Branches 8142 8167 +25
============================================
+ Hits 26870 26987 +117
- Misses 33294 33303 +9
- Partials 1734 1737 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| engine.audit-log-rollover-max-size=5gb | ||
| engine.audit-log-rollover-max-age=30d | ||
| # File transport configuration | ||
| openaev.audit-logs.file.dir=logs |
There was a problem hiding this comment.
todo: Are we aware that is a breaking changes for client ? If we want to go that way, maybe we can keep the previous global variable and add the fine-grained one.
There was a problem hiding this comment.
I'm a bit confused here. Isn't that the previous global variable values here ? This should be transparent for client, no ?
There was a problem hiding this comment.
the variable was {AUDIT_LOG_DIR} which defaulted to logs. the file name was hardcoded audit.log we now have a props that default to same file name, i dont see any breaking chanhe
| <maxHistory>90</maxHistory> | ||
| <totalSizeCap>1GB</totalSizeCap> | ||
| <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | ||
| <fileNamePattern>${AUDIT_LOG_DIR}/${AUDIT_LOG_FILENAME}.%d{yyyy-MM-dd}.%i</fileNamePattern> |
There was a problem hiding this comment.
I've been digging and it's possible when specifying the rollover format to set the format to .gz. In that case, the rolleover file will automatically be zipped. I'm wondering if we shouldn't set that by default here ? (I see no wrong in setting the rollover files as compressed given that the feature is still technically under FF)
…cation.properties
Proposed changes
Testing Instructions
Related issues
Checklist
Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...