@@ -54,6 +54,8 @@ For this, known or previously setted variables, can be used by using the '$' bef
5454
5555Common HTTP nginx builtin variables like $uri, or any other variable set by other handler modules can be used.
5656
57+ Additional variables are provided by this module. See the available variables below at [ Variables section] ( #variables ) .
58+
5759The output is sent to the location specified by the first http_log_json_format argument.
5860The possible output locations are:
5961
@@ -214,41 +216,94 @@ The format to use when writing to output destination.
214216
215217---
216218
217- * Syntax: ** " http_log_json_kafka_compression** _ compression_codec_ ;
219+ * Syntax: ** http_log_json_kafka_compression** _ compression_codec_ ;
218220* Default: snappy
219221* Context: http main
220222
221223---
222224
223- * Syntax: ** " http_log_json_kafka_log_level** _ numeric_log_level_ ;
225+ * Syntax: ** http_log_json_kafka_log_level** _ numeric_log_level_ ;
224226* Default: 6
225227* Context: http main
226228
227229---
228230
229- * Syntax: ** " http_log_json_kafka_max_retries** _ numeric_ ;
231+ * Syntax: ** http_log_json_kafka_max_retries** _ numeric_ ;
230232* Default: 0
231233* Context: http main
232234
233235---
234236
235- * Syntax: ** " http_log_json_kafka_buffer_max_messages** _ numeric_ ;
237+ * Syntax: ** http_log_json_kafka_buffer_max_messages** _ numeric_ ;
236238* Default: 100000
237239* Context: http main
238240
239241---
240242
241- * Syntax: ** " http_log_json_kafka_backoff_ms** _ numeric_ ;
243+ * Syntax: ** http_log_json_kafka_backoff_ms** _ numeric_ ;
242244* Default: 10
243245* Context: http main
244246
245247---
246248
247- * Syntax: ** " http_log_json_kafka_partition** _ partition_ ;
249+ * Syntax: ** http_log_json_kafka_partition** _ partition_ ;
248250* Default: RD_KAFKA_PARTITION_UA
249251* Context: http local
250252
253+ ---
254+
255+ * Syntax: ** http_log_json_req_body_limit** _ size_ ;
256+ * Default: 512
257+ * Context: local
258+
259+ Limits the body size to log.
260+ Argument is a size string. May be 1k or 1M, but avoid this!
261+
262+ ### Variables
263+
264+ #### $http_log_json_req_headers;
265+
266+ Creates a json object with all request headers.
267+
268+ Example:
269+
270+ ```
271+ "req": {
272+ "headers": {
273+ "Host": "localhost",
274+ "User-Agent": "curl/7.52.1",
275+ "Accept": "*/*"
276+ }
277+ }
278+ ```
279+
280+ #### $http_log_json_req_body;
281+
282+ Log request body encoded as base64.
283+ It requires proxy_pass configuration at logging location.
284+
285+ Example:
286+
287+ ```
288+ "req": {
289+ "body": "Zm9v"
290+ }
291+ ```
292+ #### $http_log_json_resp_headers;
293+
294+ Creates a json object with available response headers.
295+
296+ Example:
251297
298+ ```
299+ resp": {
300+ "headers": {
301+ "Last-Modified": "Sat, 01 Apr 2017 13:34:28 GMT",
302+ "ETag": "\"58dfac64-12\"",
303+ "X-Foo": "bar",
304+ "Accept-Ranges": "bytes"
305+ }
306+ ```
252307
253308### Build
254309
@@ -368,9 +423,9 @@ Percentage of the requests served within a certain time (ms)
368423 99% 1
369424 100% 115 (longest request)
370425
371- real 1m36.057s
372- user 0m5.390s
373- sys 1m22.040s
426+ real 1m36.057s
427+ user 0m5.390s
428+ sys 1m22.040s
374429
375430$ wc -l /tmp/1M.log
3764311000000 /tmp/1M.log
@@ -435,7 +490,8 @@ Percentage of the requests served within a certain time (ms)
435490 99% 2
436491 100% 1022 (longest request)
437492
438- real 1m43.328s
439- user 0m5.770s
440- sys 1m21.380s
493+ real 1m43.328s
494+ user 0m5.770s
495+ sys 1m21.380s
441496```
497+
0 commit comments