Skip to main content

此版本的 GitHub Enterprise 已停止服务 2022-06-03. 即使针对重大安全问题,也不会发布补丁。 要获得更好的性能、改进的安全性和新功能,请升级到 GitHub Enterprise 的最新版本。 如需升级方面的帮助,请联系 GitHub Enterprise 支持

关于系统日志

GitHub Enterprise Server 保留系统事件的错误和消息日志。 日志对于� �识用户、应用程序和系统级操作和异常非常有用。

系统日志

默认情况下,GitHub Enterprise Server 的系统日志每 24 小时自动轮换一次,并保留 7 天。 系统日志包括系统级事件、应用程序日志和 Git 事件数据。 由于日志文件经常被写入并且可能很大,� 此在与您的 GitHub Enterprise Server 实例分开的主机上提取和分析相关日志条目可能会有所帮助。

您可以将系统日志转发到第三方系统或服务器,以便延长保留期。 更多信息请参阅“日志转发。”

除了查看系统日志外,您还可以通过其他方式监控企业中的活动,例如查看审� �日志、推送日志和管理全局 web 挂钩。 更多信息请参阅“监控企业中的活动”。

日志类型

下面列出了 GitHub Enterprise Server 设备使用的主要日志及其功能:

路径描述​
/var/log/github/audit.log审� �的用户、存储库和系统事件。
/var/log/github/unicorn.logAPI 和 web 接口流量。
/var/log/github/exceptions.log应用程序级错误。
/var/log/haproxy.log到达设备的所有 IP 流量。
/var/log/hookshot/resqued.logWeb 挂钩交付和失败。
/var/log/github/auth.log身份验证请求,� 论是通过内置、LDAP、CAS 还是 SAML 方法。
/var/log/github/gitauth.log所有 Git 身份验证请求。

Git 活动和身份验证请求由 babeld 服务处理。

一些 GitHub Enterprise Server 服务(如 babeld 服务)是容器化的。 容器化日志被写入 systemd journal,可以随时使用 journalctl 命令进行查询。

已审� �的系统事件

audit.log 文件中的所有条目都使用,可以使用 github_audit 关键字进行筛选。

例如,此条目显示已创建的新仓库。

Oct 26 01:42:08 github-ent github_audit: {:created_at=>1351215728326, :actor_ip=>"10.0.0.51", :data=>{}, :user=>"some-user", :repo=>"some-user/some-repository", :actor=>"some-user", :actor_id=>2, :user_id=>2, :action=>"repo.create", :repo_id=>1, :from=>"repositories#create"}

此示例显示提交已推送到仓库。

Oct 26 02:19:31 github-ent github_audit: { "pid":22860, "ppid":22859, "program":"receive-pack", "git_dir":"/data/repositories/some-user/some-repository.git", "hostname":"github-ent", "pusher":"some-user", "real_ip":"10.0.0.51", "user_agent":"git/1.7.10.4", "repo_id":1, "repo_name":"some-user/some-repository", "transaction_id":"b031b7dc7043c87323a75f7a92092ef1456e5fbaef995c68", "frontend_ppid":1, "repo_public":true, "user_name":"some-user", "user_login":"some-user", "frontend_pid":18238, "frontend":"github-ent", "user_email":"some-user@github.example.com", "user_id":2, "pgroup":"github-ent_22860", "status":"post_receive_hook", "features":" report-status side-band-64k", "received_objects":3, "receive_pack_size":243, "non_fast_forward":false, "current_ref":"refs/heads/main" }

支持包

支持包中包括系统日志,所有审� �信息都记录到 github-logs 目录中的 audit.log 文件。 更多信息请参阅“向 GitHub Support 提供数据”。

延伸阅读