dockergitlabgrayloggelf

How to send logs from Gitlab Pipeline jobs to Graylog?


I need to send logs like those from jobs executed in Gitlab pipeline to Graylog. Is it possible to do it straight from Gitlab runner containers?

I have a docker installed on my Virtual Machine with one Gitlab runner container and I would like to send job logs from Docker to Graylog server. I checked docker documentation and set logging driver to gelf in /etc/docker/daemon.json like this.

{
  "log-driver": "gelf",
  "log-opts": {
    "gelf-address": "udp://10.10.10.4:12201"
  }
}

I receive some logs from this runner container but there are no any logs from Gitlab Pipeline's jobs execution. It seems like runner containers doesn't store those logs? I tried docker logs gitlab-runner command on another machine without gelf driver and it doesn't show logs from jobs either. Is there some way to solve it?


Solution

  • Job traces are sent to GitLab and stored as artifacts. If you self-host gitlab, you can forward the logs from your GitLab server using the log forwarder. By default, the logs will be with other artifacts under var/opt/gitlab/gitlab-rails/shared/artifacts

    Job logs are otherwise not present in the runner.