-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Manually create user log files #3903
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3903 +/- ##
==========================================
- Coverage 75.9% 71.25% -4.66%
==========================================
Files 147 145 -2
Lines 7048 7045 -3
Branches 422 436 +14
==========================================
- Hits 5350 5020 -330
- Misses 1698 2025 +327
Continue to review full report at Codecov.
|
@@ -75,6 +85,8 @@ class DockerToActivationFileLogStore(system: ActorSystem, destinationDirectory: | |||
* once the defined limit is reached. | |||
*/ | |||
val bufferSize = 100.MB | |||
val perms = java.util.EnumSet.of(OWNER_READ, OWNER_WRITE, GROUP_READ, GROUP_WRITE, OTHERS_READ, OTHERS_WRITE) | |||
val attr = PosixFilePermissions.asFileAttribute(perms) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a more restrictive set of permissions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The permissions in the current code base are too restrictive. Perhaps the OTHERS_WRITE
can be removed here though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Permissions from current code base are OWNER_READ
, OWNER_WRITE
, GROUP_READ
, OTHERS_READ
. We need GROUP_WRITE
for a log issue.
d4699a2
to
0d5b204
Compare
PG1 3181 🔵 |
val logFilePath = destinationDirectory.resolve(s"userlogs-${Instant.now.toEpochMilli}.log") | ||
logging.info(this, s"Rotating log file to '$logFilePath'") | ||
Files.createFile(logFilePath, attr) | ||
Files.setPosixFilePermissions(logFilePath, perms) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both of these can throw an IOException. I'm assuming such an error would cause the wrapping RetrySink to trigger a restart? Should we make sure the message is logged accordingly?
These two lines seem to be redundant, aren't the parameters already passed in the createFile
call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createFile
does not properly set the file permissions, relying on setPosixFilePermissions
instead.
I threw an error from inside the LogRotatorSink
function, the RestartSink
did indeed attempt to recreate the log file.
e6f7ea2
to
c3c7d29
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Do not rely on LogRotatorSink to create user log files. Instead manually create the user log files with custom permissions.
Description
Do not rely on LogRotatorSink to create user log files. Instead manually create the user log files with custom permissions.
Related issue and scope
My changes affect the following components
Types of changes
Checklist: