Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab CI/CD job's log exceeded limit

When I run my job on Gitlab CI/CD, after a while I obtain the following error message:

Job's log exceeded limit of 4194304 bytes. 

How to change this limit?

like image 217
Ortomala Lokni Avatar asked Nov 29 '18 14:11

Ortomala Lokni


People also ask

Where are GitLab job logs stored?

By default job logs are sent from the GitLab Runner in chunks and cached temporarily on disk in /var/opt/gitlab/gitlab-ci/builds by Omnibus GitLab.

Can GitLab runner run multiple jobs?

One way to allow more jobs to run simultaneously is to simply register more runners. Each installation of GitLab Runner can register multiple distinct runner instances. They operate independently of each other and don't all need to refer to the same coordinating server.

Where is config TOML?

You can find the config. toml file in: /etc/gitlab-runner/ on *nix systems when GitLab Runner is executed as root (this is also the path for service configuration)


2 Answers

To change the build log size of your jobs in Gitlab CI/CD, you can edit your config.toml file and add a new limit in kilobytes:

[[runners]]   output_limit = 10000 

According to the documentation

output_limit : Maximum build log size in kilobytes. Default is 4096 (4MB).

For this to take effect, you need to restart the gitlab runner:

sudo gitlab-runner restart 
like image 150
Ortomala Lokni Avatar answered Oct 18 '22 17:10

Ortomala Lokni


So an answer for those that don't have access to the gitlab-runners configuration file that @Ortomala Lokni refers too.

You can redirect the logger output and archive it quite easily by doing the following (Note: this is done for maven builds).

quality-check:     extends: .retry-on-job-failure     stage: quality-check     timeout: 2 hours     artifacts:         name: "$CI_BUILD"         paths:             - target/client-quality_check.log         when: always         expire_in: 3 days     only:         - main         - merge_requests     script:         - echo "Sonar Qube Start"         - mvn MAVEN_CLI_OPTS sonar:sonar --log-file target/client-quality_check.log \-Dsonar.projectKey=$PROJECT_ KEY \-Dsonar.host.url=$SONAR_HOST_URL \-Dsonar.login=$SONAR_TOKEN          - echo "Sonar Qube Complete" 

Notice within the maven command I am using the --log-file to redirect the maven output to target/client-quality_check.log and then under artifacts I have set to archive this log file by providing the path to the file.

Once this Job finishes I can then look at the Jobs archives and can see my log file with all the logger output in it.

like image 25
Popeye Avatar answered Oct 18 '22 18:10

Popeye