added missing field in query log (#291)

This commit is contained in:
Dimitri Herzog 2021-09-25 22:13:34 +02:00
parent f0a94a0e55
commit 598849efd3
1 changed files with 5 additions and 0 deletions

View File

@ -1,6 +1,8 @@
package querylog
import (
"strings"
"github.com/0xERR0R/blocky/log"
"github.com/0xERR0R/blocky/util"
"github.com/miekg/dns"
@ -20,7 +22,10 @@ func NewLoggerWriter() *LoggerWriter {
func (d *LoggerWriter) Write(entry *Entry) {
d.logger.WithFields(
logrus.Fields{
"client_ip": entry.Request.ClientIP,
"client_names": strings.Join(entry.Request.ClientNames, "; "),
"response_reason": entry.Response.Reason,
"question": util.QuestionToString(entry.Request.Req.Question),
"response_code": dns.RcodeToString[entry.Response.Res.Rcode],
"answer": util.AnswerToString(entry.Response.Res.Answer),
"duration_ms": entry.DurationMs,