- ``True`` if the log line was handled (that is, if it was really a
- dnscache log line), and ``False`` otherwise.
+ Either the human-readable string if the log line was handled (that
+ is, if it was really a dnscache log line), or ``None`` if it was
+ not.
Examples
--------
>>> line = "2022-09-15 18:37:33.863805500 query 1 7f000001:a3db:4fb9 1 www.example.com."
>>> handle_dnscache_log(line)
Examples
--------
>>> line = "2022-09-15 18:37:33.863805500 query 1 7f000001:a3db:4fb9 1 www.example.com."
>>> handle_dnscache_log(line)
>>> line = "2022-09-15 18:37:33.863874500 tx 0 1 www.example.com. . c0a80101"
>>> handle_dnscache_log(line)
>>> line = "2022-09-15 18:37:33.863874500 tx 0 1 www.example.com. . c0a80101"
>>> handle_dnscache_log(line)
>>> line = "2022-09-15 18:37:33.878529500 rr c0a80101 20865 1 www.example.com. 5db8d822"
>>> handle_dnscache_log(line)
>>> line = "2022-09-15 18:37:33.878529500 rr c0a80101 20865 1 www.example.com. 5db8d822"
>>> handle_dnscache_log(line)
- ``True`` if the log line was handled (that is, if it was really a
- tinydns log line), and ``False`` otherwise.
+ Either the human-readable string if the log line was handled (that
+ is, if it was really a tinydns log line), or ``None`` if it was
+ not.
Examples
--------
>>> line = "2022-09-14 21:04:40.206516500 7f000001:9d61:be69 - 0001 www.example.com"
>>> handle_tinydns_log(line)
Examples
--------
>>> line = "2022-09-14 21:04:40.206516500 7f000001:9d61:be69 - 0001 www.example.com"
>>> handle_tinydns_log(line)
(timestamp, ip, port, id, code, type, name) = match.groups()
ip = convert_ip(ip)
(timestamp, ip, port, id, code, type, name) = match.groups()
ip = convert_ip(ip)
type = int(type, 16) # "001c" -> 28
type = query_type.get(type, type) # 28 -> "aaaa"
type = int(type, 16) # "001c" -> 28
type = query_type.get(type, type) # 28 -> "aaaa"
if code != "/":
# If the query can actually be parsed, the log line is a
# bit more informative than it would have been otherwise.
line_tpl += " (id {id}): {type} {name}"
if code != "/":
# If the query can actually be parsed, the log line is a
# bit more informative than it would have been otherwise.
line_tpl += " (id {id}): {type} {name}"