Introspect system logs on Gitlab CI hosted on gitlab.com

Is there a way to take a look at the logs from Gitlab CI hosted on gitlab.com, other than the ones at https://gitlab.com/%YOUR_TEAM%/%REPO%/-/jobs/%ID%?
All threads I’ve found so far talk about the servers where users have system-level access.

I’m hitting an issue where a job stops proceeding without any output and hits 1 hour job limit. So I’m interested in looking into system level logs.

Thanks.

This exports the log files (/var/log) as artifacts, and you can download it after the job is done.

image: ubuntu:16.04

job:
  script:
  - cp -r /var/log .
  artifacts:
    paths:
    - log/
1 Like

Thank you, that looks a nice idea, but I only see an empty folder in my artifact view after CI jobs finish. I also tried specific path like the following but I only see a folder gitlab-ci_var_log with its content empty at https://gitlab.com/%ORG%/%REPO%/-/jobs/%PIPELINE_ID%/artifacts/browse.

Any idea what’s wrong?

:
  script:
  - cp -r /var/log ${CI_PROJECT_DIR}/gitlab-ci_var_log
:
  artifacts:
    paths:
    - ${CI_PROJECT_DIR}/gitlab-ci_var_log

Here is a test project https://gitlab.com/dosuken123/check-syslog

For exmaple, you can download the sys logs from https://gitlab.com/dosuken123/check-syslog/-/jobs/47752347/artifacts/download

You need to have syslog or rsyslog installed.

Note that @shinya uses image: ubuntu:16.04 which has a system logger installed. In that case logs are generated.

The default image used by GitLab.com runners does not have rsyslog installed.