mirror of
https://github.com/coredns/coredns.git
synced 2025-10-30 09:43:17 -04:00
middleware/log: make {size} the length of the request (#449)
* middleware/log: make {size} the length of the request
{size} is the lenght of the request, {rsize} is the length of the
reply.
* Fix test
This commit is contained in:
@@ -42,6 +42,7 @@ func New(r *dns.Msg, rr *dnsrecorder.Recorder, emptyValue string) Replacer {
|
||||
"{when}": func() string {
|
||||
return time.Now().Format(timeFormat)
|
||||
}(),
|
||||
"{size}": strconv.Itoa(req.Len()),
|
||||
"{remote}": req.IP(),
|
||||
"{port}": req.Port(),
|
||||
},
|
||||
@@ -53,7 +54,7 @@ func New(r *dns.Msg, rr *dnsrecorder.Recorder, emptyValue string) Replacer {
|
||||
rcode = strconv.Itoa(rr.Rcode)
|
||||
}
|
||||
rep.replacements["{rcode}"] = rcode
|
||||
rep.replacements["{size}"] = strconv.Itoa(rr.Len)
|
||||
rep.replacements["{rsize}"] = strconv.Itoa(rr.Len)
|
||||
rep.replacements["{duration}"] = time.Since(rr.Start).String()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user