Viewing logs in GitLab is a necessary operation for GitLab administrators to perform system management and maintenance. GitLab provides a wealth of operation logs, allowing administrators to easily understand the running status and operation of the system, discover problems in a timely manner and handle them. The following is how to view logs on the GitLab server side.
1. Log in to the GitLab server
Log in to the GitLab administrator account on the server.
2. Enter the GitLab installation directory
Enter the GitLab installation directory, usually located in the /opt/gitlab directory.
3. Use the cat command to view the log
Enter the following command in the terminal to view the main log of GitLab:
sudo cat /var/log/gitlab/gitlab-rails/production.log
This command will output all the contents in production.log to the terminal. Among them, the main log files of the GitLab Rails application are stored in the /var/log/gitlab/gitlab-rails/ directory. You can use the ls command to view all log files in the directory. Use the tail command to view the log content in real time, such as:
tail -f /var/log/gitlab/gitlab-rails/production.log
4. View GitLab exception log
GitLab Exception logs can help administrators discover system problems and locate the cause of the problems. You can view the exception log in the GitLab installation directory:
sudo cat /var/log/gitlab/gitlab-rails/production_json.log
This log file records the JSON of the GitLab Rails application Exception information. You can use the cat command to browse the entire file, or you can use the grep command to quickly find information about specific exceptions, for example:
sudo cat /var/log/gitlab/gitlab-rails/production_json.log | grep "error message"
5. View other logs
In addition to the main logs and exception logs of the GitLab Rails application, the GitLab system will also record other logs with information related to the operation of the system itself. Other common log files include:
1.gitlab-shell log
gitlab-shell includes the basic application for processing Git command requests, and its log file is located at /var/log/gitlab/gitlab -shell/ directory.
sudo cat /var/log/gitlab/gitlab-shell/gitlab-shell.log
2.unicorn log
unicorn is the server for the GitLab Rails application, and its log files are located at /var/log/gitlab/unicorn/ directory.
sudo cat /var/log/gitlab/unicorn/unicorn_stdout.log
The above is how to view the log on the GitLab server. By viewing logs, administrators can understand the running status and operation of the GitLab system, and discover and solve problems in a timely manner.
The above is the detailed content of How to view logs on the gitlab server side. For more information, please follow other related articles on the PHP Chinese website!