Skip to content

Latest commit

 

History

History
148 lines (108 loc) · 3.92 KB

advanced_config.md

File metadata and controls

148 lines (108 loc) · 3.92 KB

DNS-collector - Advanced configuration Guide

Configuration checks

DNS-collector also supports a dry-run mode for configuration verification. Run the following command to check your setup:

./go-dnscollector -config config.yml -test-config
INFO: 2023/12/24 14:43:29.043730 main - config OK!

Global settings

Trace

Enable logging to capture detailed information, such as debug and error messages generated by the application.

Options

  • verbose: (boolean) debug informations, if turned on, log some applications messages
  • filename: (string) filename is the file to write logs to.
  • max-size: (integer) maximum size in megabytes of the log file it gets rotated
  • max-backups: (integer) maximum number of old log files to retain
  • log-malformed: (boolean) log malformed packet

Example Configuration

global:
  trace:
    verbose: true
    log-malformed: false
    filename: ""
    max-size: 10
    max-backups: 10

Sample Log Output

INFO: 2022/06/25 20:54:18.173239 main - version 0.0.0
INFO: 2022/06/25 20:54:18.173271 main - config loaded...
INFO: 2022/06/25 20:54:18.173277 main - starting dns-collector...
....
INFO: 2022/06/25 20:54:18.174256 [dtap] dnstap collector - running in background...
INFO: 2022/06/25 20:54:18.174286 [dtap] dnstap collector - is listening on [::]:6000

Server Identity

Set the server identity name. If this field is left empty, the hostname will be used as the identity.

Example Configuration

global:
  server-identity: "dns-collector"

Worker Settings

The interval-monitor in second(s) is used to count every XX second the number of in/out packets.

The buffer-size settings enable to adjust the size of the buffer before discard additional packets. If you encounter the warning message buffer is full, xxx packet(s) dropped, consider increasing this parameter to prevent message drops.

Example Configuration

global:
  worker:
    interval-monitor: 10
    buffer-size: 8192

PID file

Specify the path for the DNS-Collector PID file. By default, this setting is empty.

Example Configuration

global:
  pid-file: "/path/to/your/pidfile.pid"

Telemetry

Enable and configure telemetry for monitoring purposes.

Example Configuration

global:
  telemetry:
    enabled: false
    web-path: "/metrics"
    web-listen: ":9165"
    prometheus-prefix: "dnscollector_exporter"
    tls-support: false
    tls-cert-file: ""
    tls-key-file: ""
    client-ca-file: ""
    basic-auth-enable: false
    basic-auth-login: admin
    basic-auth-pwd: changeme

Default text format

These settings can be used to set the text format for all loggers.

text-format: "timestamp-rfc3339ns identity operation rcode queryip queryport family protocol length-unit qname qtype latency"
text-format-delimiter: " "
text-format-boundary: "\""
text-jinja: ""

Configuration reloading

DNS-collector automatically reloads its configuration upon receiving a SIGHUP signal, allowing you to update settings without restarting the service.

To trigger a reload, send the SIGHUP signal:

$ sudo pkill -HUP dnscollector

Expected output:

WARNING: 2024/10/28 18:37:05.046321 main - SIGHUP received
INFO: 2024/10/28 18:37:05.049529 worker - [tap] dnstap - reload configuration...
INFO: 2024/10/28 18:37:05.050071 worker - [tofile] file - reload configuration...
INFO: 2024/10/28 18:37:05.050132 worker - [tofile] file - running in mode: json
INFO: 2024/10/28 18:37:05.050765 worker - [prom] prometheus - reload configuration...
INFO: 2024/10/28 18:37:05.051304 worker - [console] stdout - reload configuration...