+ config: new setting "querylog_file_enabled"
Close #876
Squashed commit of the following:
commit f83f60a7340d8a3f6de7ecfebb426e47d19e83d8
Merge: cfb72869 391e6199
Author: Simon Zolin <s.zolin@adguard.com>
Date: Thu May 28 15:17:21 2020 +0300
Merge remote-tracking branch 'origin/master' into 876-logs
commit cfb72869f7cf0bf59a478ab8c7920c273e2fa5f9
Author: Simon Zolin <s.zolin@adguard.com>
Date: Thu May 28 12:50:02 2020 +0300
tests
commit 35376e4f450cf66507d733c931b7ed27eff1f36c
Author: Simon Zolin <s.zolin@adguard.com>
Date: Wed May 27 18:15:12 2020 +0300
fix
commit 0cfb802d73db52a4b09c459a68a8a18918447b76
Author: Simon Zolin <s.zolin@adguard.com>
Date: Wed May 27 16:49:52 2020 +0300
tests
commit 03ca280b6aed3a4880a9d4f4cd18bf47b1c742f6
Author: Simon Zolin <s.zolin@adguard.com>
Date: Wed May 27 15:32:27 2020 +0300
+ config: new setting "querylog_file_enabled" - query log will be written to a file
This commit is contained in:
@@ -78,10 +78,11 @@ type dnsConfig struct {
|
||||
// time interval for statistics (in days)
|
||||
StatsInterval uint32 `yaml:"statistics_interval"`
|
||||
|
||||
QueryLogEnabled bool `yaml:"querylog_enabled"` // if true, query log is enabled
|
||||
QueryLogInterval uint32 `yaml:"querylog_interval"` // time interval for query log (in days)
|
||||
QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk
|
||||
AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats
|
||||
QueryLogEnabled bool `yaml:"querylog_enabled"` // if true, query log is enabled
|
||||
QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` // if true, query log will be written to a file
|
||||
QueryLogInterval uint32 `yaml:"querylog_interval"` // time interval for query log (in days)
|
||||
QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk
|
||||
AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats
|
||||
|
||||
dnsforward.FilteringConfig `yaml:",inline"`
|
||||
|
||||
@@ -138,6 +139,7 @@ func initConfig() {
|
||||
config.WebSessionTTLHours = 30 * 24
|
||||
|
||||
config.DNS.QueryLogEnabled = true
|
||||
config.DNS.QueryLogFileEnabled = true
|
||||
config.DNS.QueryLogInterval = 90
|
||||
config.DNS.QueryLogMemSize = 1000
|
||||
|
||||
@@ -239,9 +241,10 @@ func (c *configuration) write() error {
|
||||
}
|
||||
|
||||
if Context.queryLog != nil {
|
||||
dc := querylog.DiskConfig{}
|
||||
dc := querylog.Config{}
|
||||
Context.queryLog.WriteDiskConfig(&dc)
|
||||
config.DNS.QueryLogEnabled = dc.Enabled
|
||||
config.DNS.QueryLogFileEnabled = dc.FileEnabled
|
||||
config.DNS.QueryLogInterval = dc.Interval
|
||||
config.DNS.QueryLogMemSize = dc.MemSize
|
||||
config.DNS.AnonymizeClientIP = dc.AnonymizeClientIP
|
||||
|
||||
@@ -40,6 +40,7 @@ func initDNSServer() error {
|
||||
}
|
||||
conf := querylog.Config{
|
||||
Enabled: config.DNS.QueryLogEnabled,
|
||||
FileEnabled: config.DNS.QueryLogFileEnabled,
|
||||
BaseDir: baseDir,
|
||||
Interval: config.DNS.QueryLogInterval,
|
||||
MemSize: config.DNS.QueryLogMemSize,
|
||||
|
||||
Reference in New Issue
Block a user