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

Implement log fetching #243

Merged
merged 4 commits into from
Dec 18, 2023
Merged

Implement log fetching #243

merged 4 commits into from
Dec 18, 2023

Conversation

smlx
Copy link
Member

@smlx smlx commented Jul 6, 2023

This feature allows users who can ssh into a pod to instead gather container logs from the pod to be returned via the SSH connection.

Features:

  • Select service, and optionally container to retrieve logs from.
  • Select number of log lines to return.
  • Optionally stream logs live from the service (i.e. "follow").
  • Select all pods in a service and seamlessly handle scaling up/down (pods being added/removed from service).
  • Timestamp and pod/container prefix on all log lines, with format matching kubectl log.

How to use:

ssh $PROJECT-$ENVIRONMENT@$SSH_PORTAL_HOSTNAME service=$SERVICE [container=$CONTAINER] logs=tailLines=$LINES[,follow]

This feature is disabled by default. Enable it via the LOG_ACCESS_ENABLED=true environment variable, or by the --log-access-enabled CLI flag.

Closes: #149

@smlx smlx force-pushed the logs2 branch 2 times, most recently from 23304a1 to 6905437 Compare July 6, 2023 04:33
@smlx smlx force-pushed the logs2 branch 3 times, most recently from 314b339 to 2c7431d Compare July 21, 2023 09:35
@smlx smlx marked this pull request as ready for review July 21, 2023 09:37
@smlx smlx force-pushed the logs2 branch 4 times, most recently from cb995c4 to 16a3c39 Compare July 24, 2023 04:13
@smlx
Copy link
Member Author

smlx commented Jul 24, 2023

Here's an experimental branch on lagoon-cli that adds a logs command. The branch is just a PoC because it doesn't handle follow correctly due to buffering output.

https://github.com/uselagoon/lagoon-cli/tree/logs

@smlx
Copy link
Member Author

smlx commented Dec 18, 2023

This outstanding PR is blocking other work, so I'm merging it now. The feature is disabled by default, and not yet part of any chart release.

@smlx smlx merged commit 00164b5 into main Dec 18, 2023
9 checks passed
@smlx smlx deleted the logs2 branch December 18, 2023 09:21
@shreddedbacon
Copy link
Member

This outstanding PR is blocking other work, so I'm merging it now. The feature is disabled by default, and not yet part of any chart release.

Sorry, haven't had time to review it properly with everything else going on at the moment. Quick 👀 seems fine though, disabled by default is 🆗

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.

log retrieval command
2 participants