Search code examples
gitlabgitlab-ci-runnergrayloggelf

Save job traces from Gitlab Runner and redirect to Graylog


Is that possible to save/redirect Gitlab job traces(like for example this)? My Gitlab runners work in docker containers and I would like to save logs from executed jobs to syslog on the machine, then forward them to Graylog server. I was thinking about some python script catching and redirecting logs, but I don't know how to start and I am not sure if it's a good lead.

I know that job traces are stored on Gitlab Server, but I don't have access to it and need to do this a different way.

I hope my explanation is understandable, I am new to Gitlab CI.


Solution

  • Job traces aren't ever stored in files on the gitlab runner. They are only transmitted to the GitLab server and there is no option for local log propagation/redirection when using any of the official executors.

    If you don't have direct access to the GitLab server storage, you can use the jobs API to retrieve trace logs from the GitLab server. You could then use any normal mechanisms for forwarding those logs to graylog, like a forwarder agent or whatever.