# This configuration sets up DNS traffic monitoring through DNStap on port 6000;
# and add geographical metadata with GeoIP database
#
# As prerequisites, we assume you have 
# - a DNS server which supports DNSTap (unbound, bind, powerdns, etc) for more informations about dnstap, 
#   read the following page: https://dmachard.github.io/posts/0001-dnstap-testing/

# If turned on, debug messages are printed in the standard output
global:
  trace:
    verbose: true

pipelines:
  # Listen on tcp/6000 for incoming DNSTap protobuf messages from dns servers
  # and try to add country name in metadata
  - name: tap
    dnstap:
      listen-ip: 0.0.0.0
      listen-port: 6000
    transforms:
      geoip:
        mmdb-country-file: "./tests/testsdata/GeoLite2-Country.mmdb"
    # Routes DNS messages from the tap collector to standard output
    routing-policy:
      forward: [ console ]

  # Print DNS messages on standard output with TEXT format
  # Configure a custom text format to display the country name
  - name: console
    stdout:
      mode: text
      text-format: "localtime identity queryip qname qtype geoip-country rcode"
