/doc/administration/logs.md

https://gitlab.com/visay/gitlab-ce · Markdown · 148 lines · 114 code · 34 blank · 0 comment · 0 complexity · 822e9aae0284b2451f25becd01f68638 MD5 · raw file

  1. # Log system
  2. GitLab has an advanced log system where everything is logged so that you
  3. can analyze your instance using various system log files. In addition to
  4. system log files, GitLab Enterprise Edition comes with Audit Events.
  5. Find more about them [in Audit Events
  6. documentation](http://docs.gitlab.com/ee/administration/audit_events.html)
  7. System log files are typically plain text in a standard log file format.
  8. This guide talks about how to read and use these system log files.
  9. ## `production.log`
  10. This file lives in `/var/log/gitlab/gitlab-rails/production.log` for
  11. Omnibus GitLab packages or in `/home/git/gitlab/log/production.log` for
  12. installations from source. (When Gitlab is running in an environment
  13. other than production, the corresponding logfile is shown here.)
  14. It contains information about all performed requests. You can see the
  15. URL and type of request, IP address and what exactly parts of code were
  16. involved to service this particular request. Also you can see all SQL
  17. request that have been performed and how much time it took. This task is
  18. more useful for GitLab contributors and developers. Use part of this log
  19. file when you are going to report bug. For example:
  20. ```
  21. Started GET "/gitlabhq/yaml_db/tree/master" for 168.111.56.1 at 2015-02-12 19:34:53 +0200
  22. Processing by Projects::TreeController#show as HTML
  23. Parameters: {"project_id"=>"gitlabhq/yaml_db", "id"=>"master"}
  24. ... [CUT OUT]
  25. Namespaces"."created_at" DESC, "namespaces"."id" DESC LIMIT 1 [["id", 26]]
  26. CACHE (0.0ms) SELECT "members".* FROM "members" WHERE "members"."source_type" = 'Project' AND "members"."type" IN ('ProjectMember') AND "members"."source_id" = $1 AND "members"."source_type" = $2 AND "members"."user_id" = 1 ORDER BY "members"."created_at" DESC, "members"."id" DESC LIMIT 1 [["source_id", 18], ["source_type", "Project"]]
  27. CACHE (0.0ms) SELECT "members".* FROM "members" WHERE "members"."source_type" = 'Project' AND "members".
  28. (1.4ms) SELECT COUNT(*) FROM "merge_requests" WHERE "merge_requests"."target_project_id" = $1 AND ("merge_requests"."state" IN ('opened','reopened')) [["target_project_id", 18]]
  29. Rendered layouts/nav/_project.html.haml (28.0ms)
  30. Rendered layouts/_collapse_button.html.haml (0.2ms)
  31. Rendered layouts/_flash.html.haml (0.1ms)
  32. Rendered layouts/_page.html.haml (32.9ms)
  33. Completed 200 OK in 166ms (Views: 117.4ms | ActiveRecord: 27.2ms)
  34. ```
  35. In this example we can see that server processed an HTTP request with URL
  36. `/gitlabhq/yaml_db/tree/master` from IP 168.111.56.1 at 2015-02-12
  37. 19:34:53 +0200. Also we can see that request was processed by
  38. `Projects::TreeController`.
  39. ## `application.log`
  40. This file lives in `/var/log/gitlab/gitlab-rails/application.log` for
  41. Omnibus GitLab packages or in `/home/git/gitlab/log/application.log` for
  42. installations from source.
  43. It helps you discover events happening in your instance such as user creation,
  44. project removing and so on. For example:
  45. ```
  46. October 06, 2014 11:56: User "Administrator" (admin@example.com) was created
  47. October 06, 2014 11:56: Documentcloud created a new project "Documentcloud / Underscore"
  48. October 06, 2014 11:56: Gitlab Org created a new project "Gitlab Org / Gitlab Ce"
  49. October 07, 2014 11:25: User "Claudie Hodkiewicz" (nasir_stehr@olson.co.uk) was removed
  50. October 07, 2014 11:25: Project "project133" was removed
  51. ```
  52. ## `githost.log`
  53. This file lives in `/var/log/gitlab/gitlab-rails/githost.log` for
  54. Omnibus GitLab packages or in `/home/git/gitlab/log/githost.log` for
  55. installations from source.
  56. GitLab has to interact with Git repositories but in some rare cases
  57. something can go wrong and in this case you will know what exactly
  58. happened. This log file contains all failed requests from GitLab to Git
  59. repositories. In the majority of cases this file will be useful for developers
  60. only. For example:
  61. ```
  62. 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
  63. error: failed to push some refs to '/Users/vsizov/gitlab-development-kit/repositories/gitlabhq/gitlab_git.git'
  64. ```
  65. ## `sidekiq.log`
  66. This file lives in `/var/log/gitlab/gitlab-rails/sidekiq.log` for
  67. Omnibus GitLab packages or in `/home/git/gitlab/log/sidekiq.log` for
  68. installations from source.
  69. GitLab uses background jobs for processing tasks which can take a long
  70. time. All information about processing these jobs are written down to
  71. this file. For example:
  72. ```
  73. 2014-06-10T07:55:20Z 2037 TID-tm504 ERROR: /opt/bitnami/apps/discourse/htdocs/vendor/bundle/ruby/1.9.1/gems/redis-3.0.7/lib/redis/client.rb:228:in `read'
  74. 2014-06-10T18:18:26Z 14299 TID-55uqo INFO: Booting Sidekiq 3.0.0 with redis options {:url=>"redis://localhost:6379/0", :namespace=>"sidekiq"}
  75. ```
  76. ## `gitlab-shell.log`
  77. This file lives in `/var/log/gitlab/gitlab-shell/gitlab-shell.log` for
  78. Omnibus GitLab packages or in `/home/git/gitlab-shell/gitlab-shell.log` for
  79. installations from source.
  80. GitLab shell is used by Gitlab for executing Git commands and provide
  81. SSH access to Git repositories. For example:
  82. ```
  83. I, [2015-02-13T06:17:00.671315 #9291] INFO -- : Adding project root/example.git at </var/opt/gitlab/git-data/repositories/root/dcdcdcdcd.git>.
  84. I, [2015-02-13T06:17:00.679433 #9291] INFO -- : Moving existing hooks directory and symlinking global hooks directory for /var/opt/gitlab/git-data/repositories/root/example.git.
  85. ```
  86. ## `unicorn\_stderr.log`
  87. This file lives in `/var/log/gitlab/unicorn/unicorn_stderr.log` for
  88. Omnibus GitLab packages or in `/home/git/gitlab/log/unicorn_stderr.log` for
  89. installations from source.
  90. Unicorn is a high-performance forking Web server which is used for
  91. serving the GitLab application. You can look at this log if, for
  92. example, your application does not respond. This log contains all
  93. information about the state of unicorn processes at any given time.
  94. ```
  95. I, [2015-02-13T06:14:46.680381 #9047] INFO -- : Refreshing Gem list
  96. I, [2015-02-13T06:14:56.931002 #9047] INFO -- : listening on addr=127.0.0.1:8080 fd=12
  97. I, [2015-02-13T06:14:56.931381 #9047] INFO -- : listening on addr=/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket fd=13
  98. I, [2015-02-13T06:14:56.936638 #9047] INFO -- : master process ready
  99. I, [2015-02-13T06:14:56.946504 #9092] INFO -- : worker=0 spawned pid=9092
  100. I, [2015-02-13T06:14:56.946943 #9092] INFO -- : worker=0 ready
  101. I, [2015-02-13T06:14:56.947892 #9094] INFO -- : worker=1 spawned pid=9094
  102. I, [2015-02-13T06:14:56.948181 #9094] INFO -- : worker=1 ready
  103. W, [2015-02-13T07:16:01.312916 #9094] WARN -- : #<Unicorn::HttpServer:0x0000000208f618>: worker (pid: 9094) exceeds memory limit (320626688 bytes > 247066940 bytes)
  104. W, [2015-02-13T07:16:01.313000 #9094] WARN -- : Unicorn::WorkerKiller send SIGQUIT (pid: 9094) alive: 3621 sec (trial 1)
  105. I, [2015-02-13T07:16:01.530733 #9047] INFO -- : reaped #<Process::Status: pid 9094 exit 0> worker=1
  106. I, [2015-02-13T07:16:01.534501 #13379] INFO -- : worker=1 spawned pid=13379
  107. I, [2015-02-13T07:16:01.534848 #13379] INFO -- : worker=1 ready
  108. ```
  109. ## `repocheck.log`
  110. This file lives in `/var/log/gitlab/gitlab-rails/repocheck.log` for
  111. Omnibus GitLab packages or in `/home/git/gitlab/log/repocheck.log` for
  112. installations from source.
  113. It logs information whenever a [repository check is run][repocheck] on a project.
  114. [repocheck]: repository_checks.md