mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 18:53:43 -04:00
mw/logs: add rflags to logging (#845)
Add the DNS message response flags as {rflags} to the default logging
Also complete the replacer testing that is was commented out.
And (unrelated) Switch erratic and whoami to ease testing.
Note: {flags} could and should be added as well - but we can leave that
as a beginners bug.
This commit is contained in:
@@ -55,26 +55,28 @@ response placeholders.
|
||||
|
||||
The following place holders are supported:
|
||||
|
||||
* `{type}`: qtype of the request.
|
||||
* `{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.
|
||||
* `{size}`: request size in bytes.
|
||||
* `{port}`: client's port.
|
||||
* `{duration}`: response duration.
|
||||
* `{>bufsize}`: the EDNS0 buffer size advertised.
|
||||
* `{>do}`: is the EDNS0 DO (DNSSEC OK) bit set.
|
||||
* `{type}`: qtype of the request
|
||||
* `{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
|
||||
* `{size}`: request size in bytes
|
||||
* `{port}`: client's port
|
||||
* `{duration}`: response duration
|
||||
* `{rcode}`: response RCODE
|
||||
* `{rsize}`: response size
|
||||
* `{>rflags}`: response flags, each set flag will be displayed, e.g. "aa, tc". This includes the qr
|
||||
bit as well.
|
||||
* `{>bufsize}`: the EDNS0 buffer size advertised in the query
|
||||
* `{>do}`: is the EDNS0 DO (DNSSEC OK) bit set in the query
|
||||
* `{>id}`: query ID
|
||||
* `{>opcode}`: query OPCODE.
|
||||
* `{rcode}`: response RCODE.
|
||||
* `{rsize}`: response size.
|
||||
* `{>opcode}`: query OPCODE
|
||||
|
||||
The default Common Log Format is:
|
||||
|
||||
~~~ txt
|
||||
`{remote} - [{when}] "{type} {class} {name} {proto} {size} {>do} {>bufsize}" {rcode} {rsize} {duration}`
|
||||
`{remote} - [{when}] "{type} {class} {name} {proto} {size} {>do} {>bufsize}" {rcode} {>rflags} {rsize} {duration}`
|
||||
~~~
|
||||
|
||||
## Examples
|
||||
|
||||
@@ -78,10 +78,10 @@ type Rule struct {
|
||||
}
|
||||
|
||||
const (
|
||||
// DefaultLogFilename is the default output name.
|
||||
// DefaultLogFilename is the default output name. This is the only supported value.
|
||||
DefaultLogFilename = "stdout"
|
||||
// CommonLogFormat is the common log format.
|
||||
CommonLogFormat = `{remote} ` + CommonLogEmptyValue + ` [{when}] "{type} {class} {name} {proto} {size} {>do} {>bufsize}" {rcode} {rsize} {duration}`
|
||||
CommonLogFormat = `{remote} ` + CommonLogEmptyValue + ` [{when}] "{type} {class} {name} {proto} {size} {>do} {>bufsize}" {rcode} {>rflags} {rsize} {duration}`
|
||||
// CommonLogEmptyValue is the common empty log value.
|
||||
CommonLogEmptyValue = "-"
|
||||
// CombinedLogFormat is the combined log format.
|
||||
|
||||
Reference in New Issue
Block a user