mirror of
https://github.com/coredns/coredns.git
synced 2025-12-20 09:05:14 -05:00
logging: unify pkg/log and plugin/log (#2245)
Default to using pkg/log for all logging and use a fixed time prefix which is RFC3339Millli (doesn't exist in time, so we just extended RFC3339), i.e. Nano might be pushing it. Logs go from: 2018/10/30 19:14:55 [INFO] CoreDNS-1.2.5 2018/10/30 19:14:55 [INFO] linux/amd64, go1.11, to: 2018-10-30T19:10:07.547Z [INFO] CoreDNS-1.2.5 2018-10-30T19:10:07.547Z [INFO] linux/amd64, go1.11, Which includes the timezone - which oddly the std log package doesn't natively do. Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
@@ -7,9 +7,10 @@
|
||||
## Description
|
||||
|
||||
By just using *log* you dump all queries (and parts for the reply) on standard output. Options exist
|
||||
to tweak the output a little.
|
||||
to tweak the output a little. The date/time prefix on log lines is RFC3339 formatted with
|
||||
milliseconds.
|
||||
|
||||
Note that for busy servers this will incur a performance hit.
|
||||
Note that for busy servers logging will incur a performance hit.
|
||||
|
||||
## Syntax
|
||||
|
||||
@@ -59,7 +60,6 @@ The following place holders are supported:
|
||||
* `{name}`: qname of the request
|
||||
* `{class}`: qclass of the request
|
||||
* `{proto}`: protocol used (tcp or udp)
|
||||
* `{when}`: time of the query
|
||||
* `{remote}`: client's IP address, for IPv6 addresses these are enclosed in brackets: `[::1]`
|
||||
* `{size}`: request size in bytes
|
||||
* `{port}`: client's port
|
||||
@@ -76,9 +76,15 @@ The following place holders are supported:
|
||||
The default Common Log Format is:
|
||||
|
||||
~~~ txt
|
||||
`{remote}:{port} - [{when}] {>id} "{type} {class} {name} {proto} {size} {>do} {>bufsize}" {rcode} {>rflags} {rsize} {duration}`
|
||||
`{remote}:{port} - {>id} "{type} {class} {name} {proto} {size} {>do} {>bufsize}" {rcode} {>rflags} {rsize} {duration}`
|
||||
~~~
|
||||
|
||||
Each of these logs will be outputted with `log.Infof`, so a typical example looks like this:
|
||||
|
||||
~~~ txt
|
||||
2018-10-30T19:10:07.547Z [INFO] [::1]:50759 - 29008 "A IN example.org. udp 41 false 4096" NOERROR qr,rd,ra,ad 68 0.037990251s
|
||||
~~~~
|
||||
|
||||
## Examples
|
||||
|
||||
Log all requests to stdout
|
||||
|
||||
Reference in New Issue
Block a user