Log system

Log system

GitLab 具有一个高级日志系统,可以记录所有内容,因此您可以使用各种系统日志文件分析实例. 除了系统日志文件,GitLab 企业版还提供审核事件. 找到有关它们的更多信息.

系统日志文件通常是标准日志文件格式的纯文本. 本指南讨论如何读取和使用这些系统日志文件.

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/gitlab-rails/production_json.log ,对于从源代码进行安装则位于/home/git/gitlab/log/production_json.log中. 当 GitLab 在生产环境以外的环境中运行时,此处将显示相应的日志文件.

由于Lograge ,它包含从 GitLab 接收到的 Rails 控制器请求的结构化日志. 请注意,来自 API 的请求将记录到api_json.log的单独文件中.

每行包含一个可以由 Elasticsearch 和 Splunk 之类的服务提取的 JSON 行. 为了便于阅读,在示例中添加了换行符:

此示例是针对特定问题的 GET 请求. 每行还包含性能数据,时间以秒为单位:

  1. duration_s :检索请求所花费的总时间
  2. queue_duration_s :请求在 GitLab Workhorse 中排队的总时间
  3. view_duration_s :在 Rails 视图中view_duration_s总时间
  4. db_duration_s :从 PostgreSQL 检索数据的总时间
  5. cpu_s :在 CPU 上花费的总时间
  6. gitaly_duration_s :Gitaly 调用花费的总时间
  7. gitaly_calls :拨打 Gitaly 的电话总数
  8. redis_calls :对 Redis 的呼叫总数
  9. redis_duration_s :从 Redis 检索数据的总时间
  10. redis_read_bytes :从 Redis 读取的总字节
  11. redis_write_bytes :写入 Redis 的总字节数
  12. redis_<instance>_calls: total number of calls made to a Redis instance
  13. redis_<instance>_duration_s :从 Redis 实例检索数据的总时间
  14. redis_<instance>_read_bytes :从 Redis 实例读取的总字节数
  15. redis_<instance>_write_bytes :写入 Redis 实例的总字节数

使用 HTTP 传输的用户克隆和获取活动作为action: git_upload_pack出现在此日志中action: git_upload_pack .

此外,日志还包含原始 IP 地址( remote_ip ),用户 ID( user_id )和用户名( username ).

如果使用则某些端点(例如/search可能会向 Elasticsearch 发出请求. 这些将另外记录elasticsearch_callselasticsearch_call_duration_s ,它们对应于:

  1. elasticsearch_calls :对 Elasticsearch 的调用总数
  2. elasticsearch_duration_s :Elasticsearch 调用花费的总时间

ActionCable 连接和订阅事件也记录到此文件中,它们遵循上面相同的格式. methodpathformat字段不适用,并且始终为空. ActionCable 连接或通道类用作controller .

  1. { "method":{}, "path":{}, "format":{}, "controller":"IssuesChannel", "action":"subscribe", "status":200, "time":"2020-05-14T19:46:22.008Z", "params":[{"key":"project_path","value":"gitlab/gitlab-foss"},{"key":"iid","value":"1"}], "remote_ip":"127.0.0.1", "user_id":1, "username":"admin", "ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:76.0) Gecko/20100101 Firefox/76.0", "correlation_id":"jSOIEynHCUa", "duration_s":0.32566 }

注意:从 GitLab 12.5 开始,如果发生错误,则classmessagebacktrace包含一个exception字段. 以前的版本包含一个error字段,而不是exception.classexception.message . 例如:

production.log

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/gitlab-rails/production.log ,对于从源代码进行安装,该文件位于/home/git/gitlab/log/production.log中. (当 GitLab 在生产环境以外的环境中运行时,此处将显示相应的日志文件.)

它包含有关所有已执行请求的信息. 您可以查看 URL 和请求类型,IP 地址,以及涉及哪些代码部分来满足此特定请求. 此外,您还可以查看所有执行的 SQL 请求以及每个请求花费的时间. 对于 GitLab 贡献者和开发人员来说,此任务更有用. 报告错误时,请使用此日志文件的一部分. 例如:

  1. Started GET "/gitlabhq/yaml_db/tree/master" for 168.111.56.1 at 2015-02-12 19:34:53 +0200
  2. Processing by Projects::TreeController#show as HTML
  3. Parameters: {"project_id"=>"gitlabhq/yaml_db", "id"=>"master"}
  4. ... [CUT OUT]
  5. Namespaces"."created_at" DESC, "namespaces"."id" DESC LIMIT 1 [["id", 26]]
  6. CACHE (0.0ms) SELECT "members".* FROM "members" WHERE "members"."source_type" = 'Project' AND "members".
  7. (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]]
  8. Rendered layouts/nav/_project.html.haml (28.0ms)
  9. Rendered layouts/_collapse_button.html.haml (0.2ms)
  10. Rendered layouts/_flash.html.haml (0.1ms)
  11. Rendered layouts/_page.html.haml (32.9ms)
  12. Completed 200 OK in 166ms (Views: 117.4ms | ActiveRecord: 27.2ms)

在此示例中,服务器在2015-02-12 19:34:53 +0200处处理了来自 IP 168.111.56.1 URL /gitlabhq/yaml_db/tree/master的 HTTP 请求. 该请求已由Projects::TreeController .

api_json.log

在 GitLab 10.0 中引入.

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/gitlab-rails/api_json.log中,对于从源代码进行安装则位于/home/git/gitlab/log/api_json.log中.

它可以帮助您查看直接向 API 发出的请求. 例如:

  1. { "time":"2018-10-29T12:49:42.123Z", "severity":"INFO", "duration":709.08, "db":14.59, "view":694.49, "status":200, "method":"GET", "path":"/api/v4/projects", "params":[{"key":"action","value":"git-upload-pack"},{"key":"changes","value":"_any"},{"key":"key_id","value":"secret"},{"key":"secret_token","value":"[FILTERED]"}], "host":"localhost", "remote_ip":"::1", "ua":"Ruby", "route":"/api/:version/projects", "user_id":1, "username":"root", "queue_duration":100.31, "gitaly_calls":30, "gitaly_duration":5.36 }

此项显示一个内部端点,该端点被访问以检查关联的 SSH 密钥是否可以通过git fetchgit clone下载有问题的项目. 在此示例中,我们看到:

  1. duration :检索请求所花费的总时间(以毫秒为单位)
  2. queue_duration :请求在 GitLab Workhorse 中排队的总时间(以毫秒为单位)
  3. method :用于发出请求的 HTTP 方法
  4. path :查询的相对路径
  5. params :在查询字符串或 HTTP 正文中传递的键/值对. 敏感参数(例如密码和令牌)被过滤掉.
  6. ua :请求者的用户代理

application.log

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/gitlab-rails/application.log ,对于来自源的安装,该文件位于/home/git/gitlab/log/application.log中.

它可以帮助您发现实例中发生的事件,例如用户创建,项目删除等. 例如:

  1. October 06, 2014 11:56: User "Administrator" (admin@example.com) was created
  2. October 06, 2014 11:56: Documentcloud created a new project "Documentcloud / Underscore"
  3. October 06, 2014 11:56: Gitlab Org created a new project "Gitlab Org / Gitlab Ce"
  4. October 07, 2014 11:25: User "Claudie Hodkiewicz" (nasir_stehr@olson.co.uk) was removed
  5. October 07, 2014 11:25: Project "project133" was removed

application_json.log

在 GitLab 12.7 中引入 .

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/gitlab-rails/application_json.log ,对于从源代码进行安装则位于/home/git/gitlab/log/application_json.log中.

它包含application.log日志的 JSON 版本,如下例所示:

  1. { "severity":"INFO", "time":"2020-01-14T13:35:15.466Z", "correlation_id":"3823a1550b64417f9c9ed8ee0f48087e", "message":"User \"Administrator\" (admin@example.com) was created" } { "severity":"INFO", "time":"2020-01-14T13:35:15.466Z", "correlation_id":"78e3df10c9a18745243d524540bd5be4", "message":"Project \"project133\" was removed" }

integrations_json.log

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/gitlab-rails/integrations_json.log ,对于从源代码进行安装则位于/home/git/gitlab/log/integrations_json.log中.

它包含有关集成活动的信息,例如 Jira,Asana 和 Irker 服务. 它使用 JSON 格式,如下例所示:

  1. { "severity":"ERROR", "time":"2018-09-06T14:56:20.439Z", "service_class":"JiraService", "project_id":8, "project_path":"h5bp/html5-boilerplate", "message":"Error sending message", "client_url":"http://jira.gitlap.com:8080", "error":"execution expired" } { "severity":"INFO", "time":"2018-09-06T17:15:16.365Z", "service_class":"JiraService", "project_id":3, "project_path":"namespace2/project2", "message":"Successfully posted", "client_url":"http://jira.example.com" }

kubernetes.log

在 GitLab 11.6 中引入.

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/gitlab-rails/kubernetes.log ,对于从源代码进行安装则位于/home/git/gitlab/log/kubernetes.log中.

它记录与 Kubernetes 集成相关的信息,包括在托管的 Kubernetes 集群上安装集群应用程序期间的错误.

每行包含一个可以由 Elasticsearch 和 Splunk 之类的服务提取的 JSON 行. 为了清楚起见,在以下示例中添加了换行符:

  1. { "severity":"ERROR", "time":"2018-11-23T15:14:54.652Z", "exception":"Kubeclient::HttpError", "error_code":401, "service":"Clusters::Applications::CheckInstallationProgressService", "app_id":14, "project_ids":[1], "group_ids":[], "message":"Unauthorized" } { "severity":"ERROR", "time":"2018-11-23T15:42:11.647Z", "exception":"Kubeclient::HttpError", "error_code":null, "service":"Clusters::Applications::InstallService", "app_id":2, "project_ids":[19], "group_ids":[], "message":"SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate)" }

git_json.log

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/gitlab-rails/git_json.log ,对于从源代码进行安装则位于/home/git/gitlab/log/git_json.log中.

注意:在 12.2 之后,此文件从githost.log重命名为git_json.log并以 JSON 格式存储.

GitLab 必须与 Git 存储库进行交互,但是在极少数情况下可能会出问题,在这种情况下,您可能需要知道到底发生了什么. 该日志文件包含从 GitLab 到 Git 存储库的所有失败请求. 在大多数情况下,此文件仅对开发人员有用. 例如:

audit_json.log

注意:大多数日志条目仅存在于GitLab Starter 中 ,而少数存在于 GitLab Core 中.

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/gitlab-rails/audit_json.log ,对于从源代码进行安装则位于/home/git/gitlab/log/audit_json.log中.

组或项目设置的更改将记录到该文件中. 例如:

  1. { "severity":"INFO", "time":"2018-10-17T17:38:22.523Z", "author_id":3, "entity_id":2, "entity_type":"Project", "change":"visibility", "from":"Private", "to":"Public", "author_name":"John Doe4", "target_id":2, "target_type":"Project", "target_details":"namespace2/project2" }

Sidekiq Logs

对于 Omnibus 安装,一些 Sidekiq 日志位于/var/log/gitlab/sidekiq/current ,如下所示.

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/gitlab-rails/sidekiq.log ,对于从源代码进行安装则位于/home/git/gitlab/log/sidekiq.log中.

GitLab 使用后台作业来处理可能需要很长时间的任务. 有关处理这些作业的所有信息都记录到该文件中. 例如:

  1. 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'
  2. 2014-06-10T18:18:26Z 14299 TID-55uqo INFO: Booting Sidekiq 3.0.0 with redis options {:url=>"redis://localhost:6379/0", :namespace=>"sidekiq"}

除了上面的格式,您可以选择为 Sidekiq 生成 JSON 日志. 例如:

  1. { "severity":"INFO", "time":"2018-04-03T22:57:22.071Z", "queue":"cronjob:update_all_mirrors", "args":[], "class":"UpdateAllMirrorsWorker", "retry":false, "queue_namespace":"cronjob", "jid":"06aeaa3b0aadacf9981f368e", "created_at":"2018-04-03T22:57:21.930Z", "enqueued_at":"2018-04-03T22:57:21.931Z", "pid":10077, "message":"UpdateAllMirrorsWorker JID-06aeaa3b0aadacf9981f368e: done: 0.139 sec", "job_status":"done", "duration":0.139, "completed_at":"2018-04-03T22:57:22.071Z", "db_duration":0.05, "db_duration_s":0.0005, "gitaly_duration":0, "gitaly_calls":0 }
  1. sidekiq['log_format'] = 'json'

对于源代码安装,请编辑gitlab.yml并设置 Sidekiq log_format配置选项:

  1. ## Sidekiq
  2. sidekiq:
  3. log_format: json

sidekiq_client.log

在 GitLab 12.9 中 .

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/gitlab-rails/sidekiq_client.log ,对于从源代码进行安装则位于/home/git/gitlab/log/sidekiq_client.log中.

该文件包含有关 Sidekiq 开始处理作业之前(例如,入队前)的日志信息.

该日志文件采用与sidekiq.log相同的结构,因此,如果您如上所述为 Sidekiq 配置了此文件,则该文件将构造为 JSON.

gitlab-shell.log

GitLab 使用 GitLab Shell 执行 Git 命令,并提供对 Git 存储库的 SSH 访问.

For GitLab versions 12.10 and up

对于 GitLab 版本 12.10 和更高版本,有 2 个gitlab-shell.log文件. 包含git-{upload-pack,receive-pack}请求的信息位于/var/log/gitlab/gitlab-shell/gitlab-shell.log . 来自 Gitaly 的与 GitLab Shell 挂钩的信息位于/var/log/gitlab/gitaly/gitlab-shell.log .

/var/log/gitlab/gitlab-shell/gitlab-shell.log示例日志条目:

  1. { "duration_ms": 74.104, "level": "info", "method": "POST", "msg": "Finished HTTP request", "time": "2020-04-17T20:28:46Z", "url": "http://127.0.0.1:8080/api/v4/internal/allowed" } { "command": "git-upload-pack", "git_protocol": "", "gl_project_path": "root/example", "gl_repository": "project-1", "level": "info", "msg": "executing git command", "time": "2020-04-17T20:28:46Z", "user_id": "user-1", "username": "root" }

/var/log/gitlab/gitaly/gitlab-shell.log示例日志条目:

  1. { "method": "POST", "url": "http://127.0.0.1:8080/api/v4/internal/allowed", "duration": 0.058012959, "gitaly_embedded": true, "pid": 16636, "level": "info", "msg": "finished HTTP request", "time": "2020-04-17T20:29:08+00:00" } { "method": "POST", "url": "http://127.0.0.1:8080/api/v4/internal/pre_receive", "duration": 0.031022552, "gitaly_embedded": true, "pid": 16636, "level": "info", "msg": "finished HTTP request", "time": "2020-04-17T20:29:08+00:00" }

对于 GitLab 12.5 至 12.9,对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/gitaly/gitlab-shell.log ,对于从源代码进行安装则位于/home/git/gitaly/gitlab-shell.log中.

Example log entries:

  1. { "method": "POST", "url": "http://127.0.0.1:8080/api/v4/internal/post_receive", "duration": 0.031809164, "gitaly_embedded": true, "pid": 27056, "level": "info", "msg": "finished HTTP request", "time": "2020-04-17T16:24:38+00:00" }

For GitLab 12.5 and earlier

对于 GitLab 12.5 和更早版本,该文件位于/var/log/gitlab/gitlab-shell/gitlab-shell.log .

示例日志条目:

executing git command <gitaly-upload-pack...使用 SSH 传输的用户克隆/获取活动将出现在此日志中.

Gitaly Logs

该文件位于/var/log/gitlab/gitaly/current ,由 . runit与 Omnibus GitLab 打包在一起,其用途的简要说明在 Omnibus GitLab 文档中提供 . ,以 Unix 时间戳格式重命名,并经过gzip压缩(如@1584057562.s ).

grpc.log

该文件位于 Omnibus GitLab 软件包的/var/log/gitlab/gitlab-rails/grpc.log中. 使用的本机gRPC日志记录.

Puma Logs

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/puma/puma_stdout.log中,对于从源代码进行的安装,该文件位于中.

puma_stderr.log

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/puma/puma_stderr.log中,对于从源代码进行的安装则位于/home/git/gitlab/log/puma_stderr.log中.

Unicorn Logs

注意:从 GitLab 13.0 开始,Puma 是基于 GitLab 多合一软件包的安装以及 GitLab Helm 图表部署中使用的默认 Web 服务器.

unicorn_stdout.log

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/unicorn/unicorn_stdout.log中,对于从源代码进行的安装,该文件位于/home/git/gitlab/log/unicorn_stdout.log中.

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/unicorn/unicorn_stderr.log中,对于来自源的安装,该文件位于/home/git/gitlab/log/unicorn_stderr.log中.

这些日志包含有关任何给定时间 Unicorn 进程状态的所有信息.

  1. I, [2015-02-13T06:14:46.680381 #9047] INFO -- : Refreshing Gem list
  2. I, [2015-02-13T06:14:56.931002 #9047] INFO -- : listening on addr=127.0.0.1:8080 fd=12
  3. I, [2015-02-13T06:14:56.931381 #9047] INFO -- : listening on addr=/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket fd=13
  4. I, [2015-02-13T06:14:56.936638 #9047] INFO -- : master process ready
  5. I, [2015-02-13T06:14:56.946504 #9092] INFO -- : worker=0 spawned pid=9092
  6. I, [2015-02-13T06:14:56.946943 #9092] INFO -- : worker=0 ready
  7. I, [2015-02-13T06:14:56.947892 #9094] INFO -- : worker=1 spawned pid=9094
  8. I, [2015-02-13T06:14:56.948181 #9094] INFO -- : worker=1 ready
  9. W, [2015-02-13T07:16:01.312916 #9094] WARN -- : #<Unicorn::HttpServer:0x0000000208f618>: worker (pid: 9094) exceeds memory limit (320626688 bytes > 247066940 bytes)
  10. W, [2015-02-13T07:16:01.313000 #9094] WARN -- : Unicorn::WorkerKiller send SIGQUIT (pid: 9094) alive: 3621 sec (trial 1)
  11. I, [2015-02-13T07:16:01.530733 #9047] INFO -- : reaped #<Process::Status: pid 9094 exit 0> worker=1
  12. I, [2015-02-13T07:16:01.534501 #13379] INFO -- : worker=1 spawned pid=13379
  13. I, [2015-02-13T07:16:01.534848 #13379] INFO -- : worker=1 ready

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/gitlab-rails/repocheck.log ,对于来自源的安装,该文件位于/home/git/gitlab/log/repocheck.log中.

每当在项目上时,它都会记录信息.

importer.log

在 GitLab 11.3 中引入.

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/gitlab-rails/importer.log ,对于从源代码进行安装则位于/home/git/gitlab/log/importer.log中.

它记录导入过程的进度.

exporter.log

在 GitLab 13.1 中引入.

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/gitlab-rails/exporter.log ,对于来自源的安装,该文件位于/home/git/gitlab/log/exporter.log中.

它记录导出过程的进度.

auth.log

在 GitLab 12.0 中引入.

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/gitlab-rails/auth.log ,对于来自源的安装,该文件位于/home/git/gitlab/log/auth.log中.

该日志记录:

  • 每当注册滥用请求时提供的信息.
  • 请求超过原始端点上的速率限制 .
  • 滥用请求.

注意:在 GitLab 12.3和更高版本中,用户 ID 和用户名也会记录在该日志中(如果有).

graphql_json.log

Introduced in GitLab 12.0.

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/gitlab-rails/graphql_json.log ,对于从源代码进行安装则位于/home/git/gitlab/log/graphql_json.log中.

GraphQL 查询记录在该文件中. 例如:

  1. {"query_string":"query IntrospectionQuery{__schema {queryType { name },mutationType { name }}}...(etc)","variables":{"a":1,"b":2},"complexity":181,"depth":1,"duration_s":7}

migrations.log

在 GitLab 12.3 中引入.

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/gitlab-rails/migrations.log ,对于从源代码进行安装则位于/home/git/gitlab/log/migrations.log中.

mail_room_json.log (default)

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/mailroom/current ,对于来自源的安装,该文件位于/home/git/gitlab/log/mail_room_json.log中.

这个结构化的日志文件将内部活动记录在mail_room gem 中. 它的名称和路径是可配置的,因此名称和路径可能与上面的不匹配.

Reconfigure Logs

为 Omnibus GitLab 软件包/var/log/gitlab/reconfigure日志文件. 从源安装没有重新配置日志. 每当手动或作为升级的一部分运行gitlab-ctl reconfigure时, gitlab-ctl reconfigure填充一个重配置日志.

根据启动重新配置的 UNIX 时间戳记来命名重新配置日志文件,例如1509705644.log

sidekiq_exporter.log and web_exporter.log

如果同时启用了 Prometheus 指标和 Sidekiq 导出器,则 Sidekiq 将启动 Web 服务器并侦听定义的端口(默认值: 8082 ). 对于 Omnibus GitLab 软件包,访问日志将在/var/log/gitlab/gitlab-rails/sidekiq_exporter.log中生成,对于从源代码进行的安装,将在/home/git/gitlab/log/sidekiq_exporter.log生成.

如果同时启用了 Prometheus 指标和 Web 导出器,则 Puma / Unicorn 将启动 Web 服务器并侦听定义的端口(默认值: 8083 ). 对于 Omnibus GitLab 软件包,访问日志将在/var/log/gitlab/gitlab-rails/web_exporter.log中生成,对于源安装,将在/home/git/gitlab/log/web_exporter.log生成.

database_load_balancing.log

在 GitLab 12.3 中引入 .

包含 GitLab 的详细信息. 它存储在:

  • /var/log/gitlab/gitlab-rails/database_load_balancing.log用于 Omnibus GitLab 软件包.
  • /home/git/gitlab/log/database_load_balancing.log用于从源代码进行安装.

elasticsearch.log

在 GitLab 12.6 中引入.

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/gitlab-rails/elasticsearch.log ,对于来自源的安装,该文件位于/home/git/gitlab/log/elasticsearch.log中.

它记录与 Elasticsearch Integration 相关的信息,包括在索引或搜索 Elasticsearch 期间发生的错误.

每行包含一个可以由 Elasticsearch 和 Splunk 之类的服务提取的 JSON 行. 为了清楚起见,在以下示例行中添加了换行符:

  1. { "severity":"DEBUG", "time":"2019-10-17T06:23:13.227Z", "correlation_id":null, "message":"redacted_search_result", "class_name":"Milestone", "id":2, "ability":"read_milestone", "current_user_id":2, "query":"project" }

exceptions_json.log

在 GitLab 12.6 中引入 .

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/gitlab-rails/exceptions_json.log ,对于从源代码进行安装则位于/home/git/gitlab/log/exceptions_json.log中.

它记录有关Gitlab::ErrorTracking跟踪的异常的信息,该信息提供了一种标准且一致的方式来 .

每行包含一个可由 Elasticsearch 摄取的 JSON 行. 例如:

  1. { "severity": "ERROR", "time": "2019-12-17T11:49:29.485Z", "correlation_id": "AbDVUrrTvM1", "extra.project_id": 55, "extra.relation_key": "milestones", "extra.relation_index": 1, "exception.class": "NoMethodError", "exception.message": "undefined method `strong_memoize' for #<Gitlab::ImportExport::RelationFactory:0x00007fb5d917c4b0>", "exception.backtrace": [ "lib/gitlab/import_export/relation_factory.rb:329:in `unique_relation?'", "lib/gitlab/import_export/relation_factory.rb:345:in `find_or_create_object!'" ] }

service_measurement.log

在 GitLab 13.0 中引入.

对于 Omnibus GitLab 软件包,此文件位于/var/log/gitlab/gitlab-rails/service_measurement.log ,对于来自源的安装,该文件位于/home/git/gitlab/log/service_measurement.log中.

它仅包含一个结构化日志,其中包含每个服务执行的度量. 它将包含诸如 SQL 调用数, execution_timegc_statsmemory usage gc_stats .

例如:

  1. { "severity":"INFO", "time":"2020-04-22T16:04:50.691Z","correlation_id":"04f1366e-57a1-45b8-88c1-b00b23dc3616","class":"Projects::ImportExport::ExportService","current_user":"John Doe","project_full_path":"group1/test-export","file_path":"/path/to/archive","gc_stats":{"count":{"before":127,"after":127,"diff":0},"heap_allocated_pages":{"before":10369,"after":10369,"diff":0},"heap_sorted_length":{"before":10369,"after":10369,"diff":0},"heap_allocatable_pages":{"before":0,"after":0,"diff":0},"heap_available_slots":{"before":4226409,"after":4226409,"diff":0},"heap_live_slots":{"before":2542709,"after":2641420,"diff":98711},"heap_free_slots":{"before":1683700,"after":1584989,"diff":-98711},"heap_final_slots":{"before":0,"after":0,"diff":0},"heap_marked_slots":{"before":2542704,"after":2542704,"diff":0},"heap_eden_pages":{"before":10369,"after":10369,"diff":0},"heap_tomb_pages":{"before":0,"after":0,"diff":0},"total_allocated_pages":{"before":10369,"after":10369,"diff":0},"total_freed_pages":{"before":0,"after":0,"diff":0},"total_allocated_objects":{"before":24896308,"after":24995019,"diff":98711},"total_freed_objects":{"before":22353599,"after":22353599,"diff":0},"malloc_increase_bytes":{"before":140032,"after":6650240,"diff":6510208},"malloc_increase_bytes_limit":{"before":25804104,"after":25804104,"diff":0},"minor_gc_count":{"before":94,"after":94,"diff":0},"major_gc_count":{"before":33,"after":33,"diff":0},"remembered_wb_unprotected_objects":{"before":34284,"after":34284,"diff":0},"remembered_wb_unprotected_objects_limit":{"before":68568,"after":68568,"diff":0},"old_objects":{"before":2404725,"after":2404725,"diff":0},"old_objects_limit":{"before":4809450,"after":4809450,"diff":0},"oldmalloc_increase_bytes":{"before":140032,"after":6650240,"diff":6510208},"oldmalloc_increase_bytes_limit":{"before":68537556,"after":68537556,"diff":0}},"time_to_finish":0.12298400001600385,"number_of_sql_calls":70,"memory_usage":"0.0 MiB","label":"process_48616"}

geo.log

在 9.5 中引入.

Geo 将结构化日志消息存储在geo.log文件中. 对于 Omnibus 安装,此文件位于/var/log/gitlab/gitlab-rails/geo.log .

该文件包含有关 Geo 何时尝试同步存储库和文件的信息. 文件中的每一行都包含一个可以提取的单独的 JSON 条目. 例如,Elasticsearch 或 Splunk.

For example:

  1. {"severity":"INFO","time":"2017-08-06T05:40:16.104Z","message":"Repository update","project_id":1,"source":"repository","resync_repository":true,"resync_wiki":true,"class":"Gitlab::Geo::LogCursor::Daemon","cursor_delay_s":0.038}

此消息表明,Geo 检测到项目1需要存储库更新.

对于 Omnibus 安装,容器注册表日志位于/var/log/gitlab/registry/current .

NGINX Logs

对于 Omnibus 安装,NGINX 日志位于:

  • /var/log/gitlab/nginx/gitlab_access.log包含对 GitLab 的请求的日志.
  • /var/log/gitlab/nginx/gitlab_error.log包含有关 GitLab 的 NGINX 错误的日志.
  • /var/log/gitlab/nginx/gitlab_pages_access.log包含对 Pages 静态站点的请求的日志.
  • /var/log/gitlab/nginx/gitlab_pages_error.log包含 Pages 静态站点的 NGINX 错误日志.
  • /var/log/gitlab/nginx/gitlab_registry_access.log包含对容器注册表进行的请求的日志.
  • /var/log/gitlab/nginx/gitlab_registry_error.log包含容器注册表的 NGINX 错误日志.
  • /var/log/gitlab/nginx/gitlab_mattermost_access.log包含对 Mattermost 的请求日志.
  • /var/log/gitlab/nginx/gitlab_mattermost_error.log包含 Mattermost 的 NGINX 错误日志.

以下是默认的 GitLab NGINX 访问日志格式:

  1. $remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"

Pages Logs

对于 Omnibus 安装,Pages 日志位于/var/log/gitlab/gitlab-pages/current .

例如:

    Mattermost Logs

    For Omnibus GitLab installations, Mattermost logs reside in /var/log/gitlab/mattermost/mattermost.log.

    Workhorse Logs

    对于 Omnibus GitLab 安装,Workhorse 日志位于/var/log/gitlab/gitlab-workhorse/ .

    PostgreSQL Logs

    对于 Omnibus GitLab 安装,PostgreSQL 日志位于/var/log/gitlab/postgresql/ .

    Prometheus Logs

    对于 Omnibus GitLab 安装,Prometheus 日志位于/var/log/gitlab/prometheus/ .

    Redis Logs

    对于所有安装的 GitLab,它返回的日志位于/var/log/gitlab/redis/ .

    Alertmanager Logs

    对于 Omnibus GitLab 安装,Alertmanager 日志位于/var/log/gitlab/alertmanager/ .

    Crond Logs

    对于 Omnibus GitLab 安装,crond 日志位于/var/log/gitlab/crond/ .

    Grafana Logs

    对于 Omnibus GitLab 安装,Grafana 日志位于/var/log/gitlab/grafana/ .

    LogRotate Logs

    对于 Omnibus GitLab 安装,logrotate 日志位于/var/log/gitlab/logrotate/ .

    GitLab Monitor Logs

    GitLab Exporter

    对于 Omnibus GitLab 安装,GitLab Exporter 日志位于/var/log/gitlab/gitlab-exporter/ .