4.7 Logging queries
If MyDNS is started with the
--verbose
(
-v
) option, each
query the server receives will be output via the logging mechanism specified
in your configuration file (see section
B.4 Miscellaneous configuration options.).
Each log line consists of the program name (and possibly the PID) followed by a colon,
then seventeen fields separated by spaces. For example:
| mydns: 25-Jul-2003 01:50:11+659583 #1 3987 UDP 192.168.1.1 IN ANY
bboy.net. NOERROR - 1 11 0 5 LOG Y
|
or
| mydns: 25-Jul-2003 01:50:44+720684 #2 33848 UDP 192.168.1.1 IN ANY
bogus.example.com. NXDOMAIN No_matching_resource_records 1 0 1 0 LOG N
|
In order, here's what these fields mean:
-
The date the query was received.
-
The time the query was received, then a plus sign (`+'), then the number
of microseconds after the second the query was received.
-
A pound sign (`#') followed by the server's internal ID number for this
query. The internal ID numbers begin at 0 and advance sequentially.
-
The query ID provided by the client. This is usually a seemingly-random 16-bit
number used by the client to make sure the answer it receives matches the question
it asked.
-
The transport used, always either
TCP
or UDP
.
-
The client IP address, in dotted-decimal notation.
-
The query class, always
IN
.
-
The query type, such as
A
, MX
, NS
, etc. (see section 3.3 Supported RR types).
-
The name being requested.
-
The result of the query. The following values are possible:
- NOERROR
- No error; the query was successful.
- FORMERR
- The server was unable to interpret the query.
- SERVFAIL
- MyDNS experienced an internal error, usually the result of some malformed data in the database.
- NXDOMAIN
- No resource records (of any type) exist matching the domain name requested.
- NOTIMP
- The requested type of query is not implemented.
- REFUSED
- The query was refused due to server policy. This usually happens because the client attempted
to
AXFR
a zone that they were not allowed to transfer, or because the client requested
a name within a zone for which the server is not authoritative.
-
If the previous field was anything but
NOERROR
, this is a human-readable reason
why the query failed, with any space characters in the string converted into underscore (`_')
characters. If the previous field was NOERROR
, this field contains a dash (`-').
-
The number of resource records included in the question section of the reply.
-
The number of resource records included in the answer section of the reply.
-
The number of resource records included in the authority section of the reply.
-
The number of resource records included in the additional section of the reply.
-
The word
LOG
.
-
The character `Y' if this was a cached reply, `N' if it was not.
There is a script in the contrib/
directory of the source distribution called
stats.php
that provides an example of how a script might read and parse these lines,
in case you wanted to accumulate usage information or something.