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

Limit maximum log size #2789

Merged
merged 3 commits into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions bootstrap/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,13 @@ def start(self, component_name: str) -> bool:
privileged=privileged,
network=network,
detach=True,
log_config={
"Type": "json-file",
"Config": {
"max-size": "30m",
"max-file": "3",
},
},
)
except docker.errors.APIError as error:
warn(f"Error trying to start image: {error}, reverting to default...")
Expand Down
7 changes: 7 additions & 0 deletions core/services/kraken/extension/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ async def start(self) -> None:

img_name = ext.fullname()
config["Image"] = img_name

if "HostConfig" not in config:
config["HostConfig"] = {}
if "LogConfig" not in config["HostConfig"]:
config["HostConfig"]["LogConfig"] = {}
config["HostConfig"]["LogConfig"] = {"Type": "json-file", "Config": {"max-size": "20m", "max-file": "3"}}

try:
async with DockerCtx() as client:
# Checks if image exists locally, if not tries to pull it
Expand Down
4 changes: 4 additions & 0 deletions core/services/versionchooser/utils/chooser.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ async def set_bootstrap_version(self, tag: str) -> web.StreamResponse:
"/var/run/docker.sock:/var/run/docker.sock",
"/var/logs/blueos:/var/logs/blueos",
],
"LogConfig": {
"Type": "json-file",
"Config": {"max-size": "30m", "max-file": "3"},
},
},
"Env": [f"BLUEOS_CONFIG_PATH={HOME}/.config/blueos"],
}
Expand Down