| 1 |
.\" Generated by Mmark Markdown Processor - mmark.miek.nl |
| 2 |
.TH "LOG" 7 "August 2026" "atomdns handlers" "atomdns authors" |
| 3 |
|
| 4 |
.SH "NAME" |
| 5 |
.PP |
| 6 |
\fIlog\fP \- log queries |
| 7 |
|
| 8 |
.SH "DESCRIPTION" |
| 9 |
.PP |
| 10 |
By just using \fIlog\fP you dump all queries on standard output. Note that for busy servers logging will incur a |
| 11 |
performance hit. The \fIlog\fP handler only logs properties of the incoming query. |
| 12 |
|
| 13 |
.PP |
| 14 |
Enabling or disabling the \fIlog\fP handler only affects the query logging, any other logging from atomdns will |
| 15 |
show up regardless. |
| 16 |
|
| 17 |
.PP |
| 18 |
The logging of a running server can be toggled by sending the processs a SIGUSR1 signal. This is a process |
| 19 |
wide toggle, all logging of all servers is enabled or disabled. |
| 20 |
|
| 21 |
.PP |
| 22 |
When outputting a log line, \fIlog\fP will seach for \fB\fCecs/addr\fR and \fB\fCid/id\fR in the context and will add the |
| 23 |
values to the log when found. |
| 24 |
|
| 25 |
.SH "SYNTAX" |
| 26 |
.PP |
| 27 |
.RS |
| 28 |
|
| 29 |
.nf |
| 30 |
log |
| 31 |
|
| 32 |
.fi |
| 33 |
.RE |
| 34 |
|
| 35 |
.PP |
| 36 |
Or optionally if you want to log non\-default values from the context: |
| 37 |
|
| 38 |
.PP |
| 39 |
.RS |
| 40 |
|
| 41 |
.nf |
| 42 |
log { |
| 43 |
CTX |
| 44 |
[CTX]... |
| 45 |
} |
| 46 |
|
| 47 |
.fi |
| 48 |
.RE |
| 49 |
|
| 50 |
.PP |
| 51 |
Where: |
| 52 |
|
| 53 |
.IP \(bu 4 |
| 54 |
\fBCTX\fP is a context key like \fB\fCgeoip/city\fR. A non\-existing context key is silently ignored. Adding default |
| 55 |
keys (\fB\fCecs/addr\fR and \fB\fCid/id\fR) will error. |
| 56 |
|
| 57 |
|
| 58 |
.PP |
| 59 |
A typical example looks like this: |
| 60 |
|
| 61 |
.PP |
| 62 |
.RS |
| 63 |
|
| 64 |
.nf |
| 65 |
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 |
| 66 |
|
| 67 |
.fi |
| 68 |
.RE |
| 69 |
|
| 70 |
.PP |
| 71 |
Which says: |
| 72 |
|
| 73 |
.IP \(bu 4 |
| 74 |
Zone getting the request: \fB\fCexample.org.\fR. |
| 75 |
.IP \(bu 4 |
| 76 |
Network: \fB\fCudp\fR. Other options are \fB\fCtcp\fR or \fB\fCunix\fR. |
| 77 |
.IP \(bu 4 |
| 78 |
Remote address and port: \fB\fC::1 40689\fR. |
| 79 |
.IP \(bu 4 |
| 80 |
Query ID \fB\fC23343\fR. |
| 81 |
.IP \(bu 4 |
| 82 |
Question type, question class, incoming question name: \fB\fCMX IN example.org.\fR. |
| 83 |
.IP \(bu 4 |
| 84 |
Size in bytes: \fB\fC52\fR. |
| 85 |
.IP \(bu 4 |
| 86 |
Advertised UDP buffer: \fB\fC1232\fR. |
| 87 |
.IP \(bu 4 |
| 88 |
Opcode: \fB\fCQUERY\fR. |
| 89 |
|
| 90 |
|
| 91 |
.PP |
| 92 |
Optionally we can also see: |
| 93 |
|
| 94 |
.PP |
| 95 |
.RS |
| 96 |
|
| 97 |
.nf |
| 98 |
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 |
| 99 |
|
| 100 |
.fi |
| 101 |
.RE |
| 102 |
|
| 103 |
.IP \(bu 4 |
| 104 |
\fB\fCecs.addr=....\fR, the ecs address if found in the request, via the \fIecs\fP handler. |
| 105 |
.IP \(bu 4 |
| 106 |
\fB\fCid.id=....\fR, the generated request ID, from the \fIid\fP handler. |
| 107 |
|
| 108 |
|
| 109 |
.SH "EXAMPLE" |
| 110 |
.PP |
| 111 |
Here we add location data to the request's context, \fIand\fP log that. |
| 112 |
|
| 113 |
.PP |
| 114 |
.RS |
| 115 |
|
| 116 |
.nf |
| 117 |
example.org. { |
| 118 |
geoip { |
| 119 |
city testdata/GeoIPCity.dat |
| 120 |
} |
| 121 |
log { |
| 122 |
geoip/city |
| 123 |
} |
| 124 |
whoami |
| 125 |
} |
| 126 |
|
| 127 |
.fi |
| 128 |
.RE |
| 129 |
|
| 130 |
.SH "ALSO SEE" |
| 131 |
.PP |
| 132 |
signal(7), atomdns\-ecs(7), atomdns\-id(7). |