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

App exec logs #1154

Open
aliismayilov opened this issue Oct 23, 2024 · 0 comments · May be fixed by #906
Open

App exec logs #1154

aliismayilov opened this issue Oct 23, 2024 · 0 comments · May be fixed by #906

Comments

@aliismayilov
Copy link

When executing a new command with app exec (--no-reuse) a new container is run with a command like:

$ kamal app exec 'echo hello'
...
 DEBUG [4b3c06fc] Command: docker run --rm --network kamal _env-options _options _image_name echo hello
...

I wonder if it is a design choice to not include *role.logging_args here:

def execute_in_new_container(*command, interactive: false, env:)
docker :run,
("-it" if interactive),
"--rm",
"--network", "kamal",
*role&.env_args(host),
*argumentize("--env", env),
*config.volume_args,
*role&.option_args,
config.absolute_image,
*command
end

I see that the command echo hello is logged in audit.log, but all the output from the command itself isn't logged with kamal configured logging driver.

I'd be happy to contribute by enabling logging in kamal app exec. Though, it needs to be noted that the logs emitted in a "reused" container won't appear in the kamal configured logging driver. This is due to the fact that docker exec creates a new process inside the running container and has its own stdout.

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 a pull request may close this issue.

1 participant