mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 10:43:17 -04:00
plugin/log: log remote port addr as well (#1573)
Log the remote's port, for IPv6 addr this means we should enclose the v6 address in brackets; make this the default for 'remote'.
This commit is contained in:
@@ -59,7 +59,7 @@ The following place holders are supported:
|
||||
* `{class}`: qclass of the request
|
||||
* `{proto}`: protocol used (tcp or udp)
|
||||
* `{when}`: time of the query
|
||||
* `{remote}`: client's IP address
|
||||
* `{remote}`: client's IP address, for IPv6 addresses these are enclosed in brackets: `[::1]`
|
||||
* `{size}`: request size in bytes
|
||||
* `{port}`: client's port
|
||||
* `{duration}`: response duration
|
||||
@@ -75,7 +75,7 @@ The following place holders are supported:
|
||||
The default Common Log Format is:
|
||||
|
||||
~~~ txt
|
||||
`{remote} - [{when}] {>id} "{type} {class} {name} {proto} {size} {>do} {>bufsize}" {rcode} {>rflags} {rsize} {duration}`
|
||||
`{remote}:{port} - [{when}] {>id} "{type} {class} {name} {proto} {size} {>do} {>bufsize}" {rcode} {>rflags} {rsize} {duration}`
|
||||
~~~
|
||||
|
||||
## Examples
|
||||
|
||||
@@ -78,7 +78,7 @@ type Rule struct {
|
||||
|
||||
const (
|
||||
// CommonLogFormat is the common log format.
|
||||
CommonLogFormat = `{remote} ` + CommonLogEmptyValue + ` [{when}] {>id} "{type} {class} {name} {proto} {size} {>do} {>bufsize}" {rcode} {>rflags} {rsize} {duration}`
|
||||
CommonLogFormat = `{remote}:{port} ` + CommonLogEmptyValue + ` [{when}] {>id} "{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