Debian Codegraph @

cmd/atomdns/handlers/log/README.md

raw
1 # Name
2
3 _log_ - log queries
4
5 # Description
6
7 By just using _log_ you dump all queries on standard output. Note that for busy servers logging will incur a
8 performance hit. The _log_ handler only logs properties of the incoming query.
9
10 Enabling or disabling the _log_ handler only affects the query logging, any other logging from atomdns will
11 show up regardless.
12
13 The logging of a running server can be toggled by sending the processs a SIGUSR1 signal. This is a process
14 wide toggle, all logging of all servers is enabled or disabled.
15
16 When outputting a log line, _log_ will seach for `ecs/addr` and `id/id` in the context and will add the
17 values to the log when found.
18
19 # Syntax
20
21 ```txt
22 log
23 ```
24
25 Or optionally if you want to log non-default values from the context:
26
27 ```txt
28 log {
29 CTX
30 [CTX]...
31 }
32 ```
33
34 Where:
35
36 - **CTX** is a context key like `geoip/city`. A non-existing context key is silently ignored. Adding default
37 keys (`ecs/addr` and `id/id`) will error.
38
39 A typical example looks like this:
40
41 ```txt
42 2025/10/06 07:25:52 INFO example.org. network=udp remote=::1 port=40689 id=23343 type=MX class=IN name=example.org. size=52 bufsize=1232 opcode=QUERY
43 ```
44
45 Which says:
46
47 - Zone getting the request: `example.org.`.
48 - Network: `udp`. Other options are `tcp` or `unix`.
49 - Remote address and port: `::1 40689`.
50 - Query ID `23343`.
51 - Question type, question class, incoming question name: `MX IN example.org.`.
52 - Size in bytes: `52`.
53 - Advertised UDP buffer: `1232`.
54 - Opcode: `QUERY`.
55
56 Optionally we can also see:
57
58 ```txt
59 2025/10/06 07:25:52 INFO example.org. id.id=5FOXMDAG6YAHD6R7QOZ4UTX7VQ network=udp remote=::1 port=40689 ecs.addr=198.51.100.0 id=23343 type=MX class=IN name=example.org. size=52 bufsize=1232 opcode=QUERY
60 ```
61
62 - `ecs.addr=....`, the ecs address if found in the request, via the _ecs_ handler.
63 - `id.id=....`, the generated request ID, from the _id_ handler.
64
65 # Example
66
67 Here we add location data to the request's context, _and_ log that.
68
69 ```conffile
70 example.org. {
71 geoip {
72 city testdata/GeoIPCity.dat
73 }
74 log {
75 geoip/city
76 }
77 whoami
78 }
79 ```
80
81 # See Also
82
83 signal(7), atomdns-ecs(7), atomdns-id(7).