1+ data_dir : /var/lib/vector
2+
3+ api :
4+ enabled : false
5+
16sources :
27 dnstap_tcp :
38 type : dnstap
49 address : 0.0.0.0:6001
510 mode : tcp
11+ internal_metrics :
12+ type : internal_metrics
13+
14+ transforms :
15+ dnstap_enriched :
16+ type : remap
17+ inputs :
18+ - dnstap_tcp
19+ source : |
20+ .message_type = to_string(.messageType) ?? to_string(.message_type) ?? "unknown"
21+ .proto = to_string(.socketProtocol) ?? to_string(.protocol) ?? "unknown"
22+ .family = to_string(.socketFamily) ?? to_string(.network_family) ?? "unknown"
23+ .opcode = to_string(.requestData.header.opcode) ?? to_string(.responseData.header.opcode) ?? to_string(.opcode) ?? "unknown"
24+ .rcode = to_string(.responseData.rcodeName) ?? to_string(.response_code) ?? to_string(.responseData.header.rcode) ?? "unknown"
25+ .server_id = to_string(.serverId) ?? "unknown"
26+ .qname = to_string(.question[0].domainName) ?? to_string(.query_name) ?? "unknown"
27+ .qtype = to_string(.question[0].questionType) ?? to_string(.question[0].questionTypeId) ?? to_string(.query_type) ?? "unknown"
28+ .hit = 1
29+ if exists(.requestData.time) && exists(.time) {
30+ req, err_req = to_int(.requestData.time)
31+ resp, err_resp = to_int(.time)
32+ if !is_null(err_req) { req = null }
33+ if !is_null(err_resp) { resp = null }
34+ if is_integer(req) && is_integer(resp) {
35+ diff = to_int!(resp) - to_int!(req)
36+ if diff >= 0 {
37+ .latency_ns = diff
38+ .latency_seconds = to_float(.latency_ns) / 1000000000.0
39+ }
40+ }
41+ }
42+
43+ dnstap_metrics :
44+ type : log_to_metric
45+ inputs :
46+ - dnstap_enriched
47+ metrics :
48+ - type : counter
49+ name : dns_queries_total
50+ field : hit
51+ condition : ' .message_type == "ClientQuery"'
52+ tags :
53+ family : " {{family}}"
54+ proto : " {{proto}}"
55+ opcode : " {{opcode}}"
56+ qtype : " {{qtype}}"
57+ - type : counter
58+ name : dns_responses_total
59+ field : hit
60+ condition : ' .message_type == "ClientResponse"'
61+ tags :
62+ family : " {{family}}"
63+ proto : " {{proto}}"
64+ rcode : " {{rcode}}"
65+ server : " {{server_id}}"
66+ - type : counter
67+ name : dns_nxdomain_total
68+ field : hit
69+ condition : ' .message_type == "ClientResponse" && .rcode == "NXDomain"'
70+ tags :
71+ proto : " {{proto}}"
72+ server : " {{server_id}}"
73+ - type : counter
74+ name : dns_servfail_total
75+ field : hit
76+ condition : ' .message_type == "ClientResponse" && .rcode == "ServFail"'
77+ tags :
78+ proto : " {{proto}}"
79+ server : " {{server_id}}"
80+ - type : histogram
81+ name : dns_response_latency_seconds
82+ field : latency_seconds
83+ condition : ' .message_type == "ClientResponse" && exists(.latency_seconds)'
84+ bins : [0.0001, 0.0005, 0.001, 0.005, 0.01, 0.05, 0.1, 0.25, 0.5, 1, 2, 5]
85+ tags :
86+ proto : " {{proto}}"
87+ qtype : " {{qtype}}"
88+ rcode : " {{rcode}}"
89+ server : " {{server_id}}"
690
791sinks :
892 console :
993 type : console
94+ target : stdout
95+ encoding :
96+ codec : json
1097 inputs :
1198 - dnstap_tcp
12- encoding :
13- codec : json
99+
100+ prometheus :
101+ type : prometheus_exporter
102+ inputs :
103+ - dnstap_metrics
104+ - internal_metrics
105+ address : 0.0.0.0:9598
0 commit comments