Gerrit | 日志类型及其字段详解

error_log

释义:导致 gerrit server 启动失败的日志

字段:

thread name : Java执行请求使用的线程

level:日志级别 (ERROR, WARN, INFO, DEBUG).

logger:logger 名称

message: 日志信息

stacktace:异常java栈信息

gc_log

释义:gc 的配置、gc 前后 package 信息对比

字段:

level: 日志级别 (ERROR, WARN, INFO, DEBUG).

message: log message

httpd_log

释义:获取 Gerrit 服务(GET、POST)时服务的状态码

字段:

host:发送请求的客户端名

remote logname: 远程客户端请求时的登录名,如果是 Gerrit 自身请求则显示为短划线 -

username:客户登录使用的名称,"-" 表示 匿名用户

request:请求方式,例如 POST、GET

statuscode:状态码

response size: the number of bytes of data transferred as part of the HTTP response, not including the HTTP header

latency:响应时间,毫秒

referer:the Referer HTTP request header

client agent: 发送请求的 client agent .

举例说明。如下 httpd 日志。

26.12.34.56.78 [HTTP-4136374] - johndoe [28/Aug/2020:10:02:20 +0200] "GET /a/plugins/metrics-reporter-prometheus/metrics HTTP/1.1" 200 1247498 1900 - "Prometheus/2.13.1"

sshd_log

释义:sshd 更加复杂一点,标准的日志格式包含以下内容:

字段:

date time

session-d

thread name

username

accountid:登录 gerrit 的账户

operation:通过 ssh 方式的操作,可能有以下几种用户场景:

LOGIN FROM :登录的 Host

AUTH FAILURE FROM :登录失败才有的日志

LOGOUT

git-upload-pack.:git fetch 或者 clone 某个project

git-receive-pack.:git push 某个project

wait : 等待命令执行的时间,毫秒

exec: 执行命令的耗时,毫秒

status:0 代表执行成功,其他值代表错误

其中,当 operation 是 git-upload-pack 的时候,在exec 和 status 之间,还有额外的字段:

○time negotiation:寻找待传目标耗时

○time searching for reuse:jgit 搜索增量改变的耗时

○time searching for sizes:jgit 搜索"增量压缩里的内容大小"的耗时

○time counting:jgit 列举输出内容的耗时

○time compressing:jgit 压缩操作的耗时

○time writing:jgit 写打包文件的耗时

○total time in uploadPack:jgit 上传包的耗时

○bitmap index misses:使用 bitmap 索引时未命中的数量,-1 表示没有 bitmap 索引可用

○total deltas:所有增量的数量

○total bytes:传输的总字节数

○client agent:所请求的客户端及其版本信息

# 举例
[2020-08-28 11:00:01,391 +0200] 8a154cae [sshd-SshServer[570fc452]-nio2-thread-299] voter a/1000023 LOGIN FROM 12.34.56.78[2020-08-28 11:00:01,556 +0200] 8a154cae [SSH git-upload-pack /AP/ajs/jpaas-msg-svc.git (voter)] voter a/1000056 git-upload-pack./demo/project.git 0ms 115ms 92ms 1ms 0ms 6ms 0ms 0ms 7ms 3 10 26 2615 0 git/2.26.2[2020-08-28 11:00:01,583 +0200] 8a154cae [sshd-SshServer[570fc452]-nio2-thread-168] voter a/1000023 LOGOUT

replication_log

Gerrit 同步插件往 slave 进行代码备份的日志,非gerrit标准,插件写入

delete_log

其他业务场景需要写入的日志,例如删除日志,非gerrit标准,自定义写入

编辑于 2021-05-13 11:20

文章被以下专栏收录