Logs on your node
The SQLite file of a node (logs.sqlite in the data directory) can hold
two types of records. A source column marks the type:
- Queries that the node answered. The node stores them locally when the logs of the profile are on and the destination is any destination other than Nowhere. They never leave the node, except as answers to your own dashboard requests.
- Queries that the cloud answered for the same profile. The node gets them when the log destination of the profile is My self-hosted node or Both. These records travel from the cloud to the node over its link.
The path of a cloud record
Section titled “The path of a cloud record”A device can send a query to the cloud addresses of opdns, for example a phone on mobile data. This is what happens to the record:
- The PoP (server location) resolves the query and produces the record. The logs-off and client-IP-off settings apply here, on the PoP.
- The record goes through the internal
logsstream of opdns, which holds it for at most 24 hours. - Ingest (the cloud service that receives records) applies domain logging and the destination. For a node destination, it puts the record in a queue for the profile instead of the cloud database.
- The queue sends batches down the link of the node, one batch at a time. The node writes each batch to SQLite, then acknowledges it.
- The queue drops the acknowledged batches.
If the node is offline, the queue holds records until the node reconnects.
By default, it holds them for at most 24 hours. The profile setting Hold
logs for an offline node
(Settings, node_queue_hours
in the API) can make that 12 hours or 1 hour. It can also turn the queue
off (Do not hold). The cloud then drops records made while the node is
offline. 24 hours is the maximum. Records older than the window are lost.
The cloud does not move them to the cloud database. On the Nodes page of
the dashboard, the card of the node shows how many records are waiting
(Queued logs).
So when you choose the node as the destination, the cloud still processes those queries. It holds each record for a short time on the way, but it does not keep the records. Architecture gives the full details.
Reading logs
Section titled “Reading logs”With the destination My self-hosted node, the Logs and Analytics pages of the dashboard send each request to the node over its link. They show the answer with a Your node badge. The result passes through the servers of opdns in transit, encrypted on each hop. opdns does not store it. While the live tail is open, the cloud asks the node for new rows every second. When the dashboard falls back to polling, it asks every 2 seconds.
A node runs at most link.max_inflight_queries relayed queries against
its database at the same time (default 4). It gives each query 10 seconds.
An additional query waits up to a second for a free slot. If no slot
becomes free, the node sheds the query. It answers at once with no rows
and marks the answer partial (partial_reason: overload). The dashboard
shows this as Partial results: your node is busy. A live tail keeps its
position and catches up on the next poll. On small hardware, lower the
setting.
When the node is offline, the pages tell you so and show when the node was last seen. They try again by themselves. See Logs.
With opdns cloud or Both, the pages read the copy in the cloud instead. That copy holds only the queries that opdns answered. The queries that your node answered itself stay in its SQLite file and do not appear there.
Device names on your network
Section titled “Device names on your network”Plain DNS carries no device name. Without help, queries that your devices
send to the node over plain DNS have an empty Device column. With
local.device_names on (the default), the node names such a client after
its host name from the DHCP lease files or local.hosts
(Local names). It cleans up the
name as it does for any device name. Logs and Top devices then show
laptop or tv instead of nothing. A device that sends its own name
(DoH, DoT, DoQ) keeps it. Without lease files or hosts, the node has no
names for the clients. local.device_names: false turns this feature off.
Analytics from your node
Section titled “Analytics from your node”The node answers the same analytics views as the cloud, from its SQLite file. There are two differences:
- The node classifies owners itself. The
top_ownersview shows queries by the company that they reached: Google, Apple, Meta, Amazon, Microsoft, Cloudflare, Akamai, Fastly. The node finds this view and theownerof each destination when the dashboard asks. It uses classification data built into the node release. A newer node release brings newer data, and the data applies to all the logs already stored. - The node has no GeoIP data. Its
destinationsanswers have an empty country for every address. opdns fills in the countries from its own database, while the answer passes through its servers to your dashboard. No third party looks up anything about your queries, and the cloud stores nothing.
A node older than these views answers a top_owners query with
501 shape_unsupported. Update the node. For its destinations answers,
opdns adds the country and owner columns on the way.
What ingest adds
explains how both lookups work. Attributions
credits the country data.
Retention and size
Section titled “Retention and size”The node deletes the days that are older than the retention of the
profile. If the profile sets no retention, the default is 30 days
(store.retention_days). store.max_size_mb sets the maximum file size.
The 90-day limit of the cloud applies to what opdns stores, not to your
node. An enrolled node follows the setting of the profile (1 to 90 days,
as the dashboard allows). store.retention_days and the profile file of a
standalone node have no upper limit.
Low disk space
Section titled “Low disk space”When the free space on the file system of the data directory goes below
store.min_free_mb, the node pauses logging until there is space again.
The default is 500 MB, and 0 turns this guard off. While logging is
paused:
- DNS continues to answer. The node drops only the log records, and counts them.
- The node refuses the batches that the cloud sends for it. They stay in the queue in the cloud (for the usual window of the profile, 24 hours at most), so they are not lost at once.
- The local page says “logging paused: disk”.
Schema upgrades and damage
Section titled “Schema upgrades and damage”A release that changes the database schema copies the file to
backups/pre-v<N>.db before it migrates it. If the node finds the
database corrupt at start, it moves the database to
backups/corrupt-<time>.db and replaces it with an empty one. See
what an upgrade changes on disk.
To keep the logs when you move a node, use
opdns-node backup.