Skip to content
Software capabilities

GitLab capability

Read GitLab CI job logs

Fetch a job’s trace through the Jobs API when another program needs the log. Use glab to follow a running job or open its log in GitLab.

Documentation reviewed

Ways to do it

API

GET /projects/{id}/jobs/{job_id}/trace

Return the log file for a specific job in the project.

Requirements
Project ID or URL-encoded path, numeric job ID, and API access to the project.
Limitations
GitLab returns HTTP 404 if the job or its trace is unavailable.

Example

curl --fail -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
  "$GITLAB_URL/api/v4/projects/$PROJECT_ID/jobs/$JOB_ID/trace"
Read source: GitLab Jobs API job trace

CLI

glab ci trace <job-id>

Follow a GitLab CI job’s trace in the terminal.

Requirements
glab authenticated to the GitLab host with access to the project and a job ID or name.
Limitations
When using a job name without a job ID, the branch and pipeline selection affect which trace you see.

Example

glab ci trace "$JOB_ID" --repo "$PROJECT_PATH"
Read source: GitLab CLI ci trace

Interface

Build → Jobs → job log

Select the job to watch its output or inspect a finished run.

Requirements
Project access and a job whose log is still available.
Limitations
GitLab limits job log size. Output beyond the configured limit may be missing.
Read source: GitLab CI job logs