Artica Wiki

Unbound-format query log

The DNS Firewall writes every client query, blocked ones included, to a file in the Unbound log-queries format, rotated and archived by Artica.

Back to the DNS Firewall service

Keep your Unbound logs when you move to the DNS Firewall

Moving from Unbound to the DNS Firewall no longer means rewriting your log tooling.
The DNS Firewall can write every client query to a file, one line per query, in the exact format of Unbound's log-queries option.
The scripts, parsers and SIEM rules that read your Unbound logs keep working on the first day.
Blocked, rewritten and refused queries are written too, so the file shows everything your clients asked for.
The file follows the Artica log rotation and lands in the log archive with your other DNS logs.

You turn it on with one switch.
The DNS service does not restart.

Benefits

Use cases

What a line looks like

Nov 25 18:21:09 artica-appliance dnsfw: [568525:2] info: 127.0.0.1 www.Debian.org. A IN
Nov 25 18:21:10 artica-appliance dnsfw: [568525:2] info: 127.0.0.1 8.8.8.8.in-addr.arpa. PTR IN
Nov 25 18:24:46 artica-appliance dnsfw: [584553:2] info: 127.0.0.1 www.kernel.org. A IN
Field Content
Nov 25 18:21:09 Time of the query, local time, syslog format
artica-appliance Short host name of the appliance
dnsfw: Program name
[568525:2] Process ID of the DNS service, then a number from 0 to the number of listener threads minus 1
info: Level, always info
127.0.0.1 Address of the client, as seen on the network
www.Debian.org. Name as the client sent it, with its case and the final dot
A Query type (A, AAAA, PTR, MX, HTTPS, SRV, TXT...)
IN Query class

The number after the process ID keeps the same value for a given client.
The DNS service does not expose its real thread numbers, so this number only reproduces the shape of the Unbound line.
Characters that Unbound would not print in a name (spaces, control characters, a dot inside a label) are written as ?, as Unbound does.
When a client sends an EDNS client subnet, the line still shows the address of the client itself.

Requirements

Enable the query log

  1. Open DNS > DNS Load-balancing service.
  2. Click the Global settings tab.
  3. In the Load balancing and health checks card, click Edit.
  4. In the Troubleshooting section, turn on Unbound-format query log.
  5. Keep the default Query log file (/var/log/unbound.log) or type another path.
  6. Click Apply and restart.

The Unbound-format query log switch and the Query log file field

When only the query log settings change, the DNS service keeps running.
It restarts only if you also changed another setting of the window.
The first lines appear within a second.

The card then shows the file path, the number of lines written and the number of lines lost.

The Load balancing and health checks card with the query log on, its path and its counters

An invalid path is refused with a message such as "query log path must be under /var/log/".

Check that it works

tail -f /var/log/unbound.log

The counters are also available from the Artica REST API:

curl -s --unix-socket /usr/share/artica-postfix/bin/run/articarest.sock http://localhost/dnsfw/extralogging
{"data":{"enabled":true,"path":"/var/log/unbound.log","written":122,"dropped":0,"last_error":""},"success":true}

Rotation and archive

The file follows the rotation settings of Legal logs.
With the default settings, Artica checks the size every 10 minutes and rotates the file above 100 MB.
If you chose to rotate only on schedule, the file rotates once a day at the time you set.

Rotation compresses the content into the log archive and empties the file.
The DNS Firewall keeps writing to the same file without any restart.
With the default archive folder, the archives are named like this:

/home/logrotate_backup/proxy/2026/11/25/<host>.<first date>--<last date>.unbound.log.gz

The dates come from the first and last lines of the file.

How it works

The DNS service already sends every query to Artica over dnstap, the binary DNS logging protocol.
Artica reads that stream and writes the lines itself.
The DNS service does no extra work and never waits for the disk.

The dnstap action sits before every firewall rule.
For this reason, blocked, rewritten, refused and rate-limited queries reach the file.
They also appear once in the DNS statistics of Artica.

Artica keeps up to 8192 lines in memory and writes them to disk continuously.
If the disk cannot keep up during a burst, the extra lines are dropped and counted as lines lost.
DNS resolution is never slowed down by the log.

The file belongs to root:adm with mode 0640.

Disable the query log

Turn off Unbound-format query log and click Apply and restart.
Artica writes the pending lines, then closes the file.
The file stays on disk, and the rotation stops handling it.

Artica Meta

The DNS Firewall policy of Artica Meta carries both settings, DNSDISTExtraLogging and DNSDISTExtraloggingPath.
A path sent by Artica Meta is checked again on each node.
An invalid path falls back to /var/log/unbound.log.
While a policy holds these settings, the local console refuses the change with the message "managed by Artica Meta".

Limits

Reference

Item Value
Settings (Valkey keys) DNSDISTExtraLogging (0 or 1), DNSDISTExtraloggingPath (default /var/log/unbound.log)
REST API GET /dnsfw/extralogging, POST /dnsfw/extralogging with {"enabled":1,"path":"/var/log/unbound.log"}
Writer status GET /dnstap/querylog/status
Rotation Legal logs settings, size checked every 10 minutes (100 MB by default)
File owner and mode root:adm, 0640

Always send both enabled and path in a POST.
An empty or missing path resets the setting to /var/log/unbound.log.

Troubleshooting

Symptom What to check
The card shows a red error under the counters Read the message. It usually names a missing folder or a refused path.
The status says "dnstap receiver not running" The Artica daemon starts its dnstap receiver only when the DNS Firewall is enabled at startup. Restart the artica-ad-rest service after enabling the DNS Firewall.
lines lost keeps growing The disk cannot keep up with the query rate. Move the file to a faster disk or reduce the query volume.
The file stays empty Check that clients really query this DNS Firewall. Run dig @127.0.0.1 www.debian.org on the appliance and watch the file.
The path is refused Use a path under /var/log/ ending with .log, which is not a link and not another service's log.