]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
modules/http: updated format of the /trace log
authorMarek Vavruša <mvavrusa@cloudflare.com>
Tue, 28 Nov 2017 16:34:23 +0000 (08:34 -0800)
committerMarek Vavruša <mvavrusa@cloudflare.com>
Sat, 2 Dec 2017 02:50:20 +0000 (18:50 -0800)
modules/http/README.rst
modules/http/http_trace.lua

index a176fdab15d31a3a13b3397156c6387ac38cc99f..ebf14e6b115428bd65658befd79fa0f85ca7a130 100644 (file)
@@ -114,22 +114,22 @@ The basic mode allows you to resolve a query and trace verbose logs (and message
 
 .. code-block:: bash
 
-   $ curl http://localhost:8080/trace/e.root-servers.net
-   iter | 'e.root-servers.net.' type 'A' created outbound query, parent id 0
-    rc  | => rank: 020, lowest 020, e.root-servers.net. A
-    rc  | => satisfied from cache
-   iter | <= answer received:
-   ;; ->>HEADER<<- opcode: QUERY; status: NOERROR; id: 14771
+   $ curl http://localhost:8053/trace/e.root-servers.net
+   [ 8138] [iter] 'e.root-servers.net.' type 'A' created outbound query, parent id 0
+   [ 8138] [ rc ] => rank: 020, lowest 020, e.root-servers.net. A
+   [ 8138] [ rc ] => satisfied from cache
+   [ 8138] [iter] <= answer received:
+   ;; ->>HEADER<<- opcode: QUERY; status: NOERROR; id: 8138
    ;; Flags: qr aa  QUERY: 1; ANSWER: 0; AUTHORITY: 0; ADDITIONAL: 0
 
    ;; QUESTION SECTION
    e.root-servers.net.         A
 
    ;; ANSWER SECTION
-   e.root-servers.net.         3599821 A       192.203.230.10
+   e.root-servers.net.         3556353 A       192.203.230.10
 
-   iter | <= rcode: NOERROR
-   resl | finished: 4, queries: 1, mempool: 81952 B
+   [ 8138] [iter] <= rcode: NOERROR
+   [ 8138] [resl] finished: 4, queries: 1, mempool: 81952 B
 
 How to expose services over HTTP
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
index 46a65f3de808deaafeaf933db70bf0685cd42974..c09973a0f645ef2ecbbb63ae40219f7ba2f198e1 100644 (file)
@@ -21,8 +21,9 @@ local function serve_trace(h, _)
 
        -- Create logging handler callback
        local buffer = {}
-       local buffer_log_cb = ffi.cast('trace_log_f', function (_, source, msg)
-               local message = string.format('%4s | %s', ffi.string(source), ffi.string(msg))
+       local buffer_log_cb = ffi.cast('trace_log_f', function (query, source, msg)
+               local message = string.format('[%5u] [%s] %s',
+                       tonumber(query.id), ffi.string(source), ffi.string(msg))
                table.insert(buffer, message)
        end)