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

Feature/413 limit deployment log file size #736

Merged
merged 19 commits into from
Jul 8, 2024

Conversation

mburri
Copy link
Member

@mburri mburri commented Jan 30, 2024

To be merged after #735

fixes #413

@yvespp yvespp added this to the Version 1.17.35 milestone Jan 31, 2024
Copy link
Member

Choose a reason for hiding this comment

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

Can the three classes DeploymentLog, DeploymentLogContent and DeploymentLogContent be merged into one class? Why does the id type differ per class (int, Integer and long)?

Copy link
Member Author

@mburri mburri Jun 28, 2024

Choose a reason for hiding this comment

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

Hmm... there seems to be only one DeploymentLogContent - did you mean DeploymentLogContentCommand?

Copy link
Member Author

Choose a reason for hiding this comment

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

I merged DeploymentLog and DeploymentLogContent and cleaned up the various types.
DeploymentLogContentCommand is used to encapsulate the input validation.

String name = logsPath + File.separator + logName;
File file = new File(name);

if (file.length() > 1_000_000) throw new IOException(String.format("%s is larger than 10 MB and cannot be shown.", file.getName()));
Copy link
Member

Choose a reason for hiding this comment

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

Instead of an exception, could we instead read the first 10MB of the file and append an error to it?

Copy link
Member

Choose a reason for hiding this comment

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

We could also try to stream the file instead to prevent loading it into memory completely.

Copy link
Member Author

Choose a reason for hiding this comment

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

Both are good suggestions - I'll have to check it. I wonder if the users browser will crash if we stream large files.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've chosen a third option:

Only the last 10mb of the log file is shown (if larger) and a message is prepended that says that some part of the log is missing...

I imagine that the interesting log entries are at the end of the log - and not at the beginning.

@yvespp What do you think about it?

@yvespp yvespp force-pushed the feature/413-limit-deployment-log-file-size branch from 5f413ff to 5644dbc Compare July 8, 2024 08:40
@yvespp yvespp merged commit 2948a52 into master Jul 8, 2024
1 check passed
@yvespp yvespp deleted the feature/413-limit-deployment-log-file-size branch July 8, 2024 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Limit deployment log file size to 10MB
2 participants