Denis Machard

My technical gists

Infrastructure architect by profession but always consider himself as a developer and an open source enthusiast.
@github @mastodon @rss

Collect dnstap stream and backup-it to log files with DNS-collector

Example to collect dnstap messages from dns servers and backup-it in log files

Prequisites

Install the dnscollector like described in the following guide.

Overview

With this example, the collector waits incoming dnstap messages and save-it in log files in text format with rotation.

overview dnstap

Configuration

Download the config.yml file.

global:
  trace:
    verbose: true

multiplexer:
  collectors:
    - name: "tap"
      dnstap:
        listen-ip: 0.0.0.0
        listen-port: 6000

  loggers:
    - name: file
      logfile:
        file-path:  "/var/run/dnscollector/dnstap.log"
        max-size: 100
        max-files: 10
        mode: text

  routes:
    - from: [tap]
      to: [file]

Logs

You can follow the logs like this:

tail -f /var/run/dnscollector/dnstap.log
2021-12-12T13:05:55.036223063Z 75ebec340c0c CLIENT_QUERY NOERROR 192.168.1.12 39200 INET UDP 49b ns1-1.akamaitech.net AAAA 0.000000
2021-12-12T13:05:55.036244143Z 75ebec340c0c CLIENT_RESPONSE NOERROR 192.168.1.12 39200 INET UDP 115b ns1-1.akamaitech.net AAAA 0.000021
propulsed by hugo and hugo-theme-gists