diff options
author | Mayra Cabrera <mcabrera@gitlab.com> | 2019-07-22 21:03:03 +0000 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2019-07-22 21:03:03 +0000 |
commit | c0c3e7c74da6b6f2387a227f7dfeee227fba2938 (patch) | |
tree | 3a547b281f50ddb3f41d0c6727e15e9c1576c6f8 | |
parent | 6c04066d4599af2efd4db43b2933003b8493e8dd (diff) | |
parent | 71045b89f6f0e9c347526b2d90f945dfbcbebdcc (diff) | |
download | gitlab-ce-c0c3e7c74da6b6f2387a227f7dfeee227fba2938.tar.gz |
Merge branch 'sh-make-githost-json' into 'master'
Convert githost.log to JSON format
See merge request gitlab-org/gitlab-ce!30967
-rw-r--r-- | changelogs/unreleased/sh-make-githost-json.yml | 5 | ||||
-rw-r--r-- | doc/administration/logs.md | 14 | ||||
-rw-r--r-- | lib/gitlab/git_logger.rb | 6 |
3 files changed, 16 insertions, 9 deletions
diff --git a/changelogs/unreleased/sh-make-githost-json.yml b/changelogs/unreleased/sh-make-githost-json.yml new file mode 100644 index 00000000000..f4113a693cc --- /dev/null +++ b/changelogs/unreleased/sh-make-githost-json.yml @@ -0,0 +1,5 @@ +--- +title: Convert githost.log to JSON format +merge_request: 30967 +author: +type: changed diff --git a/doc/administration/logs.md b/doc/administration/logs.md index 5a2f389d298..563701b8677 100644 --- a/doc/administration/logs.md +++ b/doc/administration/logs.md @@ -157,16 +157,22 @@ This file lives in `/var/log/gitlab/gitlab-rails/githost.log` for Omnibus GitLab packages or in `/home/git/gitlab/log/githost.log` for installations from source. +NOTE: **Note:** +After 12.2, this file will be stored in JSON format. + GitLab has to interact with Git repositories but in some rare cases something can go wrong and in this case you will know what exactly happened. This log file contains all failed requests from GitLab to Git repositories. In the majority of cases this file will be useful for developers only. For example: -``` -December 03, 2014 13:20 -> ERROR -> Command failed [1]: /usr/bin/git --git-dir=/Users/vsizov/gitlab-development-kit/gitlab/tmp/tests/gitlab-satellites/group184/gitlabhq/.git --work-tree=/Users/vsizov/gitlab-development-kit/gitlab/tmp/tests/gitlab-satellites/group184/gitlabhq merge --no-ff -mMerge branch 'feature_conflict' into 'feature' source/feature_conflict - -error: failed to push some refs to '/Users/vsizov/gitlab-development-kit/repositories/gitlabhq/gitlab_git.git' +```json +{ + "severity":"ERROR", + "time":"2019-07-19T22:16:12.528Z", + "correlation_id":"FeGxww5Hj64", + "message":"Command failed [1]: /usr/bin/git --git-dir=/Users/vsizov/gitlab-development-kit/gitlab/tmp/tests/gitlab-satellites/group184/gitlabhq/.git --work-tree=/Users/vsizov/gitlab-development-kit/gitlab/tmp/tests/gitlab-satellites/group184/gitlabhq merge --no-ff -mMerge branch 'feature_conflict' into 'feature' source/feature_conflict\n\nerror: failed to push some refs to '/Users/vsizov/gitlab-development-kit/repositories/gitlabhq/gitlab_git.git'" +} ``` ## `audit_json.log` diff --git a/lib/gitlab/git_logger.rb b/lib/gitlab/git_logger.rb index dac4ddd320f..ded5349be01 100644 --- a/lib/gitlab/git_logger.rb +++ b/lib/gitlab/git_logger.rb @@ -1,13 +1,9 @@ # frozen_string_literal: true module Gitlab - class GitLogger < Gitlab::Logger + class GitLogger < JsonLogger def self.file_name_noext 'githost' end - - def format_message(severity, timestamp, progname, msg) - "#{timestamp.to_s(:long)} -> #{severity} -> #{msg}\n" - end end end |