How can I capture logs from a GitLab CI runner's service?

I’m trying to troubleshoot some intermittent CI failures. My gitlab-ci.yml uses an ElasticSearch service which sometimes fails. I want to capture its logs and persist them alongside my other build artifacts.

I’ve read through https://docs.gitlab.com/ee/ci/docker/using_docker_images.html but I don’t see any mention of this.

Any pointers?

Hi,

looks like this isn’t directly possible, but the issue has a workaround listed: https://gitlab.com/gitlab-org/gitlab-runner/issues/2119

Cheers,
Michael

1 Like

This is possible as of GitLab 15.6 by setting the CI/CD variable CI_DEBUG_SERVICES, e.g.

variables:
  CI_DEBUG_SERVICES: "true"

Read more at Capturing service container logs

1 Like