Querylog -- Read from querylog files when answering to /querylog API, it now survives restarts.

This commit is contained in:
Eugene Bujak
2018-10-07 02:17:22 +03:00
parent 0ee112e8a0
commit a63fe958ae
2 changed files with 92 additions and 0 deletions

View File

@@ -88,6 +88,11 @@ func handleQueryLog(w http.ResponseWriter, r *http.Request) {
logBufferLock.RLock()
values := logBuffer
logBufferLock.RUnlock()
if len(values) < queryLogAPI {
values = appendFromLogFile(values, queryLogAPI, time.Hour*24)
}
var data = []map[string]interface{}{}
for _, entry := range values {
var q *dns.Msg