blob: 43a8e62dd771f29b1ce19b1093eceb6022e17561 [file] [log] [blame]
Matthias Sohn450bc202020-08-20 14:40:32 +02001= Gerrit Code Review - Logs
2
3Gerrit writes log files in the `$site_path/logs/` folder tracking requests,
4background and plugin activity and errors. By default logs are written in
5link:config-gerrit.html#log.textLogging[text format], optionally in
6link:config-gerrit.html#log.jsonLogging[JSON format].
7By default log files are link:config-gerrit.html#log.compress[compressed]
8at server startup and then daily at 11pm and
9link:config-gerrit.html#log.rotate[rotated] every midnight.
10
11== Logs
12
13The following logs can be written.
14
15=== HTTPD Log
16
17The httpd log tracks HTTP requests processed by Gerrit's http daemon
18and is written to `$site_path/logs/httpd_log`. Enabled or disabled via the
19link:config-gerrit.html#httpd.requestLog[httpd.requestLog] option.
20
21Format is an enhanced
22link:https://httpd.apache.org/docs/2.4/logs.html#combined[NCSA combined log],
23if a log field is not present, a "-" is substituted:
24
25* `host`: The IP address of the HTTP client that made the HTTP resource request.
26 If you are using a reverse proxy it depends on the proxy configuration if the
27 proxy IP address or the client IP address is logged.
28* `[thread name]`: name of the Java thread executing the request.
29* `remote logname`: the identifier used to
30 link: https://tools.ietf.org/html/rfc1413[identify the client making the HTTP request],
31 Gerrit always logs a dash `-`.
32* `username`: the username used by the client for authentication. "-" for
33 anonymous requests.
34* `[date:time]`: The date and time stamp of the HTTP request.
35 The time that the request was received. The format is until Gerrit 3.1
36 `[dd/MMM/yyyy:HH:mm:ss.SSS ZZZZ]`. For Gerrit 3.2 or newer
37 link:https://www.w3.org/TR/NOTE-datetime[ISO 8601 format] `[yyyy-MM-dd'T'HH:mm:ss,SSSZ]`
38 is used for all timestamps.
39* `request`: The request line from the client is given in double quotes.
40** the HTTP method used by the client.
41** the resource the client requested.
42** the protocol/version used by the client.
43* `statuscode`: the link:https://tools.ietf.org/html/rfc2616#section-10[HTTP status code]
44 that the server sent back to the client.
45* `response size`: the number of bytes of data transferred as part of the HTTP
46 response, not including the HTTP header.
47* `latency`: response time in milliseconds.
48* `referer`: the `Referer` HTTP request header. This gives the site that
49 the client reports having been referred from.
50* `client agent`: the client agent which sent the request.
51
52Example:
53```
5412.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"
55```
56
57=== SSHD Log
58
59The sshd log tracks ssh requests processed by Gerrit's ssh daemon
60and is written to `$site_path/logs/sshd_log`. Enabled or disabled
61via option link:config-gerrit.html#sshd.requestLog[sshd.requestLog].
62
63Log format:
64
65* `[date time]`: The time that the request was received.
66 The format is until Gerrit 3.1 `[yyyy-mm-dd HH:mm:ss.SSS ZZZZ]`.
67 For Gerrit 3.2 or newer
68 link:https://www.w3.org/TR/NOTE-datetime[ISO 8601 format] `[yyyy-MM-dd'T'HH:mm:ss,SSSZ]`
69 is used for all timestamps.
70* `sessionid`: hexadecimal session identifier, all requests of the
71 same connection share the same sessionid. Gerrit does not support multiplexing multiple
72 sessions on the same connection. Grep the log file using the sessionid as filter to
73 get all requests from that session.
74* `[thread name]`: name of the Java thread executing the request.
75* `username`: the username used by the client for authentication.
76* `a/accountid`: identifier of the Gerrit account which is logged on.
77* `operation`: the operation being executed via ssh.
78** `LOGIN FROM <host>`: login and start new SSH session from the given host.
79** `AUTH FAILURE FROM <host> <message>`: failed authentication from given host and cause of failure.
80** `LOGOUT`: logout and terminate SSH session.
81** `git-upload-pack.<projectname>`: git fetch or clone command for given project.
82** `git-receive-pack.<projectname>`: git push command for given project.
83** Gerrit ssh commands which may be logged in this field are documented
84 link:cmd-index.html#_server[here].
85* `wait`: command wait time, time in milliseconds the command waited for an execution thread.
86* `exec`: command execution time, time in milliseconds to execute the command.
87* `status`: status code. 0 means success, any other value is an error.
88
89The `git-upload-pack` command provides the following additional fields after the `exec`
90and before the `status` field. All times are in milliseconds. Fields are -1 if not available
91when the upload-pack request returns an empty result since the client's repository was up to date:
92
93* `time negotiating`: time for negotiating which objects need to be transferred.
94* `time searching for reuse`: time jgit searched for deltas which can be reused.
95 That is the time spent matching existing representations against objects that
96 will be transmitted, or that the client can be assumed to already have.
97* `time searching for sizes`: time jgit was searching for sizes of all objects that
98 will enter the delta compression search window. The sizes need to
99 be known to better match similar objects together and improve
100 delta compression ratios.
101* `time counting`: time jgit spent enumerating the objects that need to
102 be included in the output. This time includes any restarts that
103 occur when a cached pack is selected for reuse.
104* `time compressing`: time jgit was compressing objects. This is observed
105 wall-clock time and does not accurately track CPU time used when
106 multiple threads were used to perform the delta compression.
107* `time writing`: time jgit needed to write packfile, from start of
108 header until end of trailer. The transfer speed can be
109 approximated by dividing `total bytes` by this value.
110* `total time in UploadPack`: total time jgit spent in upload-pack.
111* `bitmap index misses`: number of misses when trying to use bitmap index,
112 -1 means no bitmap index available. This is the count of objects that
113 needed to be discovered through an object walk because they were not found
114 in bitmap indices.
115* `total deltas`: total number of deltas transferred. This may be lower than the actual
116 number of deltas if a cached pack was reused.
117* `total objects`: total number of objects transferred. This total includes
118 the value of `total deltas`.
119* `total bytes`: total number of bytes transferred. This size includes the pack
120 header, trailer, thin pack, and reused cached packs.
121* `client agent`: the client agent and version which sent the request.
122
123Example: a CI system established a SSH connection, sent an upload-pack command (git fetch) and closed the connection:
124```
125[2020-08-28 11:00:01,391 +0200] 8a154cae [sshd-SshServer[570fc452]-nio2-thread-299] voter a/1000023 LOGIN FROM 12.34.56.78
126[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
127[2020-08-28 11:00:01,583 +0200] 8a154cae [sshd-SshServer[570fc452]-nio2-thread-168] voter a/1000023 LOGOUT
128```
129
130=== Error Log
131
132The error log tracks errors and stack traces and is written to
133`$site_path/logs/error_log`.
134
135Log format:
136
137* `[date time]`: The time that the request was received.
138 The format is until Gerrit 3.1 `[yyyy-mm-dd HH:mm:ss.SSS ZZZZ]`.
139 For Gerrit 3.2 or newer
140 link:https://www.w3.org/TR/NOTE-datetime[ISO 8601 format] `[yyyy-MM-dd'T'HH:mm:ss,SSSZ]`
141 is used for all timestamps.
142* `[thread name]`: : name of the Java thread executing the request.
143* `level`: log level (ERROR, WARN, INFO, DEBUG).
144* `logger`: name of the logger.
145* `message`: log message.
146* `stacktrace`: Java stacktrace when an execption was caught, usually spans multiple lines.
147
148=== GC Log
149
150The gc log tracks git garbage collection running in a background thread
151if enabled and is written to `$site_path/logs/gc_log`.
152
153Log format:
154
155* `[date time]`: The time that the request was received.
156 The format is until Gerrit 3.1 `[yyyy-mm-dd HH:mm:ss.SSS ZZZZ]`.
157 For Gerrit 3.2 or newer
158 link:https://www.w3.org/TR/NOTE-datetime[ISO 8601 format] `[yyyy-MM-dd'T'HH:mm:ss,SSSZ]`
159 is used for all timestamps.
160* `level`: log level (ERROR, WARN, INFO, DEBUG).
161* `message`: log message.
162
163=== Plugin Logs
164
165Some plugins write their own log file.
166E.g. the replication plugin writes its log to `$site_path/logs/replication_log`.
167Refer to each plugin's documentation for more details on their logs.
168
169GERRIT
170------
171Part of link:index.html[Gerrit Code Review]
172
173SEARCHBOX
174---------