Debian Codegraph @

doc/source/reference/log.rst

raw
1 .. -*- rst -*-
2
3 Log
4 ===
5
6 Groonga has two log files. They are process log and query
7 log. Process log is for all of :doc:`executables/groonga`
8 works. Query log is just for query processing.
9
10 .. _process-log:
11
12 Process log
13 -----------
14
15 Process log is enabled by default. Log path can be customized by
16 :option:`groonga --log-path` option. Each log has its log level. If a
17 log is smaller than Groonga process' log level, it's not logged. Log
18 level can be customized by :option:`groonga -l` or
19 :doc:`commands/log_level`.
20
21 Format
22 ^^^^^^
23
24 Process log uses the following format::
25
26 #{TIME_STAMP}|#{L}| #{MESSAGE}
27
28 Some multi-process based applications such as
29 :doc:`/reference/executables/groonga-httpd` and `PGroonga
30 <https://pgroonga.github.io/>`_ use the following format::
31
32 #{TIME_STAMP}|#{L}|#{PID}: #{MESSAGE}
33
34 You can also show context ID that is also used in :ref:`query-log`. If
35 you also show context ID, you can associate related logs in
36 :ref:`process-log` and :ref:`query-log` easily::
37
38 #{TIME_STAMP}|#{L}|#{PID}|#{CONTEXT_ID}: #{MESSAGE}
39
40 See :option:`groonga --log-flags` how to show PID, context ID and so
41 on.
42
43 Example::
44
45 2011-07-05 08:35:09.276421|n| grn_init
46 2011-07-05 08:35:09.276553|n| RLIMIT_NOFILE(4096,4096)
47
48 Example with PID::
49
50 2011-07-05 08:35:09.276421|n|1129: grn_init
51 2011-07-05 08:35:09.276553|n|1129: RLIMIT_NOFILE(4096,4096)
52
53 Example with PID and context ID::
54
55 2025-01-27 16:39:40.709869|n|3901936|0x55788b59dbe0: grn_init: <14.0.9-27-gd6cd635>
56 2025-01-27 16:39:40.710013|n|3901936|0x55788b59dbe0: vm.overcommit_memory kernel parameter should be 1: <0>: See INFO level log to resolve this
57 2025-01-27 16:39:42.052517|n|3901936|0x55788b59dbe0: grn_fin (0)
58
59 ``TIME_STAMP``
60 ^^^^^^^^^^^^^^
61
62 It's time stamp uses the following format::
63
64 YYYY-MM-DD hh:mm:ss.SSSSSS
65
66 .. list-table::
67 :header-rows: 1
68
69 * - Format
70 - Description
71 * - ``YYYY``
72 - Year with four digits.
73 * - ``MM``
74 - Month with two digits.
75 * - ``DD``
76 - Day with two digits.
77 * - ``hh``
78 - Hour with two digits.
79 * - ``mm``
80 - Minute with two digits.
81 * - ``ss``
82 - Second with two digits.
83 * - ``SSSSSS``
84 - Microsecond with six digits.
85
86 Example::
87
88 2011-07-05 06:25:18.345734
89
90 ``L``
91 ^^^^^
92
93 Log level with a character. Here is a character and log
94 level map.
95
96 .. list-table::
97 :header-rows: 1
98
99 * - Format
100 - Description
101 * - ``E``
102 - Emergency
103 * - ``A``
104 - Alert
105 * - ``C``
106 - Critical
107 * - ``e``
108 - Error
109 * - ``w``
110 - Warning
111 * - ``n``
112 - Notification
113 * - ``i``
114 - Information
115 * - ``d``
116 - Debug
117 * - ``-``
118 - Dump
119
120 Example::
121
122 E
123
124 ``PID``
125 ^^^^^^^
126
127 The process ID.
128
129 Example::
130
131 1129
132
133 ``MESSAGE``
134 ^^^^^^^^^^^
135
136 Details about the log with free format.
137
138 Example::
139
140 log opened.
141
142 .. _query-log:
143
144 Query log
145 ---------
146
147 Query log is disabled by default. It can be enabled by
148 :option:`groonga --query-log-path` option.
149
150 Format
151 ^^^^^^
152
153 Query log uses the following formats::
154
155 #{TIME_STAMP}|#{MESSAGE}
156 #{TIME_STAMP}|#{CONTEXT_ID}|#{QUERY_STATUS}#{QUERY}
157 #{TIME_STAMP}|#{CONTEXT_ID}|#{QUERY_STATUS}#{ELAPSED_TIME} #{PROGRESS}
158 #{TIME_STAMP}|#{CONTEXT_ID}|#{QUERY_STATUS}#{ELAPSED_TIME} #{RETURN_CODE}
159
160 Example::
161
162 2011-07-05 06:25:19.458756|45ea3034|>select Properties --limit 0
163 2011-07-05 06:25:19.458829|45ea3034|:000000000072779 select(19)
164 2011-07-05 06:25:19.458856|45ea3034|:000000000099998 output(0)
165 2011-07-05 06:25:19.458875|45ea3034|<000000000119062 rc=0
166 2011-07-05 06:25:19.458986|45ea3034|>quit
167
168 ``TIME_STAMP``
169 ^^^^^^^^^^^^^^
170
171 It's time stamp uses the following format::
172
173 YYYY-MM-DD hh:mm:ss.SSSSSS
174
175 .. list-table::
176 :header-rows: 1
177
178 * - Format
179 - Description
180 * - ``YYYY``
181 - Year with four digits.
182 * - ``MM``
183 - Month with two digits.
184 * - ``DD``
185 - Day with two digits.
186 * - ``hh``
187 - Hour with two digits.
188 * - ``mm``
189 - Minute with two digits.
190 * - ``ss``
191 - Second with two digits.
192
193 ``SSSSSS``
194 Microsecond with six digits.
195
196 Example::
197
198 2011-07-05 06:25:18.345734
199
200 ``CONTEXT_ID``
201 ^^^^^^^^^^^^^^
202
203 ID of a context. Groonga process creates contexts to process requests
204 concurrently. Each context outputs some logs for a request. This ID can
205 be used to extract a log sequence by a context.
206
207 Example::
208
209 45ea3034
210
211 ``QUERY_STATUS``
212 ^^^^^^^^^^^^^^^^
213
214 .. list-table::
215 :header-rows: 1
216
217 * - Format
218 - Description
219 * - ``>``
220 - A character that indicates query is started.
221 * - ``:``
222 - A character that indicates query is processing.
223 * - ``<``
224 - A character that indicates query is finished.
225
226 ``MESSAGE``
227 ^^^^^^^^^^^
228
229 Details about the log with free format.
230
231 Example::
232
233 query log opened.
234
235 ``QUERY``
236 ^^^^^^^^^
237
238 A query to be processed.
239
240 Example::
241
242 select users --match_columns hobby --query music
243
244 ``ELAPSED_TIME``
245 ^^^^^^^^^^^^^^^^
246
247 Elapsed time in nanoseconds since query is started.
248
249 Example::
250
251 000000000075770
252 (It means 75,770 nanoseconds.)
253
254 ``PROGRESS``
255 ^^^^^^^^^^^^
256
257 A processed work at the time.
258
259 Example::
260
261 select(313401)
262 (It means that 'select' is processed and 313,401 records are remained.)
263
264 ``RETURN_CODE``
265 ^^^^^^^^^^^^^^^
266
267 A return code for the query.
268
269 Example::
270
271 rc=0
272 (It means return code is 0. 0 means GRN_SUCCESS.)