https://garden.io logo
#🌱|help-and-getting-started
Get server logs for a test or workflow run
# 🌱|help-and-getting-started
o

orange-ability-1812

07/27/2023, 5:11 PM
When running a integration tests (or workflows running them) I can't find a way to get the logs for the services that the tests are hitting. For instance if I just run an HTTP request in my test all I can see is the error status code, and I need to set up the
garden dev
environment and stream the logs to actually see the stack trace on the server side. It would be really awesome if there was a way to specify which services to capture logs for during a test run. I tried doing something like this:
Copy code
kind: Workflow
name: integration-tests
steps:
  - command: [deploy, --logs, api]
  - command: [test, integration-tests]
But it gives me an error that specifically it can't stream logs using workflows. Is there a solution I'm missing, or is this something that would be a feature request?
c

chilly-gigabyte-83853

07/28/2023, 9:15 AM
Hi @orange-ability-1812, sorry for the late reply but a bunch of us are on holiday and at conferences. So currently it's not really possible to stream live logs while using workflows. One way you could achieve that (sorry if it sounds obvious) would be opening up a terminal and stream logs from the service you are interested in (e.g.
garden logs api --follow
and in another window run the integration tests. You could also use sync mode in a similar fashion: - First you'd start the dev command with
garden dev
- then you'd deploy api in sync mode
deploy api --sync
and then you could go on
https://app.garden.io
and check the api logs from the Live page (selecting the
api
from the Sources dropdown). Of course those approaches won't work unfortunately if you are running the workflows or tests from a CI pipeline. What's your use case?
o

orange-ability-1812

07/28/2023, 12:17 PM
I've used log streaming as you've mentioned for an interactive session. My use case was to get as much context in CI logs as possible so that you might be able to figure the error out right away rather than needing to set up garden dev etc. just to find a typo was causing a 500 error.
b

bright-policeman-43626

07/29/2023, 3:19 AM
Does maybe a visual tool like Lens or K9s help you checking logs by following the pod’s? I usually find myself more productive when having the ability to easily switch contexts and see what’s wrong! @orange-ability-1812
q

quaint-dress-831

08/14/2023, 8:54 AM
@orange-ability-1812 since the use-case is log streaming for workflows in CI and it's a feature we don't support, do you mind opening a feature request for it? https://github.com/garden-io/garden/issues/new?assignees=&labels=feature+request&projects=&template=FEATURE_REQUEST.md&title=%5BFEATURE%5D%3A+
o

orange-ability-1812

08/16/2023, 5:00 PM
I think this is a good place to request first: https://github.com/garden-io/garden/issues/2970#issuecomment-1680962246 If not in scope I can write another issue.
9 Views