brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: resolvectl log-level debug turns on systemd-resolved debug logging without a restart

Systemd
~/tips/tip-dns-resolvectl-log-level-debug

sudo resolvectl log-level debug

Raises systemd-resolved's log level on the fly so lookups show up in the journal.

The usual advice for debugging a service is to edit a unit file and restart it. For systemd-resolved you can raise the log level while it runs, which is less disruptive on a machine that is half working.

sudo resolvectl log-level debug
journalctl -u systemd-resolved -f

The first line changes the log level of the manager. Without an argument the command prints the current level, so resolvectl log-level is also a quick check. It is listed as added in systemd version 244. With debug on, the journal shows what the resolver does for each query, such as which server it asks and how it reacts to an answer.

Run a lookup in another terminal while the journal is open, for example resolvectl query example.com. When you have seen enough, put it back:

sudo resolvectl log-level info

Caveat: debug logging writes the names you look up into the journal, so do not leave it on, and read those lines before you paste them anywhere public. I would also not expect the level to survive a restart of the service, since it is not saved.

Further reading: resolvectl(1) manual

More Systemd tips [Service] sudo mkdir -p /etc/systemd/system/service.d [Service] printf 'hunter2' | sudo systemd-creds encrypt --name=dbpass – dbpass.cred systemd-analyze timespan 1h30min All Systemd tips (88) All topics

Link