Skip to content

Enable Sidekiq JSON logs by default

Stan Hu requested to merge sh-enable-sidekiq-json-logs-default into master

What does this MR do?

This switches the default log format for Sidekiq to JSON. Webservice nodes generate log entries for sidekiq_client.log, often when they deduplicate jobs. Even though GitLab Logger wraps the messages in JSON, it's easier if the client logs are in JSON so their fields can be indexed properly in Elasticsearch and other tools.

Related issues

This came out of an investigation in gitlab-org/gitlab#409089 (comment 1387506519).

Also relates to:

Testing

  1. In a webservice container, run bin/rails c inside /srv/gitlab.
  2. Run Sidekiq.logger.info "This is a test".
  3. Check /var/log/gitlab/sidekiq_client.log:
$ cat /var/log/gitlab/sidekiq_client.log
# Logfile created on 2023-05-11 16:13:04 +0000 by logger.rb/v1.4.3
{"severity":"INFO","time":"2023-05-11T21:24:32.071Z","message":"This is a test"}

Checklist

See Definition of done.

For anything in this list which will not be completed, please provide a reason in the MR discussion.

Required

  • Merge Request Title and Description are up to date, accurate, and descriptive
  • MR targeting the appropriate branch
  • MR has a green pipeline on GitLab.com
  • When ready for review, MR is labeled "~workflow::ready for review" per the Distribution MR workflow

Expected (please provide an explanation if not completing)

  • Test plan indicating conditions for success has been posted and passes
  • Documentation created/updated
  • Tests added
  • Integration tests added to GitLab QA
  • Equivalent MR/issue for omnibus-gitlab opened
  • Validate potential values for new configuration settings. Formats such as integer 10, duration 10s, URI scheme://user:passwd@host:port may require quotation or other special handling when rendered in a template and written to a configuration file.
Edited by Jason Plum

Merge request reports