In an omnibus installation, the log file for GitLab Shell can be found in the following location:
/var/log/gitlab/gitlab-shell/gitlab-shell.log
Alternatively, it may be found in the following location, for installations from source:
/home/git/gitlab-shell/gitlab-shell.log
What you will generally find are log lines that concern the basic operations of GitLab Shell:
- Git commands (such as git push and git pull).
- Authorization calls to the GitLab Rails API to check whether you are allowed to connect
- Execution of pre-receive hooks
- Actions requested
- Post-receive actions
- Any custom post-receive actions
Here, we have listed some lines from the log file:
bash-4.1$ tail gitlab-shell.log
time="2018-09-26T08:59:53+02:00" level=info msg="executing git command" command="gitaly-upload-pack unix:/var/opt/gitlab/gitaly/gitaly.socket {"repository":{"storage_name":"default","relative_path":"xxx/xxx.git","git_object_directory":"","git_alternate_object_directories":[],"gl_repository":"xxx"},"gl_repository":"project-xx","gl_id":"key-xx","gl_username":"xxxxxx"}" pid=18855 user="user with key key-xx"
time="2018-09-26T08:59:53+02:00" level=info msg="finished HTTP request" duration=0.228132057
method=POST pid=18890 url="http://127.0.0.1:8080/api/v4/internal/allowed"
time="2018-09-26T08:59:54+02:00" level=info msg="finished HTTP request" duration=0.030036933 method=POST pid=18890 url="http://127.0.0.1:8080/api/v4/internal/pre_receive"
time="2018-09-26T08:59:54+02:00" level=info msg="finished HTTP request" duration=0.094035804 method=POST pid=18979 url="http://127.0.0.1:8080/api/v4/internal/post_receive"
One way to find errors is to look for certain patterns, such as failed, as follows. This particular error points to a 500 error from Unicorn while checking whether a user has the right authorization to make a call to the GitLab API.
This error should show up in the Unicorn logs (production.log) if you search for an HTTP 500 error:
bash-4.1$ grep -i failed gitlab-shell.log
time="2018-09-26T08:05:52+02:00" level=error msg="API call failed" body="{"message":"500 Internal Server Error"}" code=500 method=POST pid=1587 url="http://127.0.0.1:8080/api/v4/internal/allowed"
time="2018-09-26T08:45:13+02:00" level=error msg="API call failed" body="{"message":"500 Internal Server Error"}" code=500 method=POST pid=24813 url="http://127.0.0.1:8080/api/v4/internal/allowed"