Skip to content

varlink: add org.freedesktop.LogControl protocol - #40606

Closed
bluca wants to merge 4 commits into
systemd:mainfrom
bluca:service_log_level_varlink
Closed

bluca wants to merge 4 commits into
systemd:mainfrom
bluca:service_log_level_varlink

Conversation

@bluca

@bluca bluca commented Feb 8, 2026

Copy link
Copy Markdown
Member

Currently we have io.systemd.service.SetLogLevel. It has no getter, and takes ints as input. No interface for the target or the identifier.

The LogControl1 D-Bus interface is very nice because it's a standard interface that anything can implement, and we have it wired in systemctl service-log-level.

Add a varlink LogControl interface, that tries to follow the D-Bus one so that it's consistent and can be trivially implemented and used. Add it to all the services that currently have io.systemd.service.SetLogLevel, make systemctl use it, and document it.

@bluca

bluca commented Feb 8, 2026

Copy link
Copy Markdown
Member Author

(varlink boilerplate and docs were hallucinated by copilot, don't @ me)

bluca added 2 commits February 8, 2026 19:28
If the specified service does not provide a D-Bus interface, check
if it is tied to any socket unit. If it is, and a socket unit has
the FileDescriptorName= set to 'varlink', then fetch the patch and
introspect it, checking if it provides the org.freedesktop.LogControl
interface, and if so, use it.
This intentionally follows the D-Bus LogControl1 specification as
close as possible, to try and provide consistency since it is meant
to be a public interface.
E.g.: use strings rather than ints for log levels, unlike
io.systemd.service.SetLogLevel, provide getters, and also handle
log target and syslog identifier.
@bluca
bluca force-pushed the service_log_level_varlink branch from f40c8ae to 0a800f6 Compare February 8, 2026 19:28
@poettering

Copy link
Copy Markdown
Member

I dont get it, what does this new iface do that the existing one doesnt already?

@poettering

Copy link
Copy Markdown
Member

it sounds ok extending the existing service interface, but i see no reason to add yet another one

@poettering poettering added reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks and removed please-review PR is ready for (re-)review by a maintainer labels Feb 8, 2026
Comment thread src/shared/meson.build
'varlink-io.systemd.service.c',
'varlink-io.systemd.sysext.c',
'varlink-log-control-api.c',
'varlink-org.freedesktop.LogControl.c',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, a i don't think we should use the fdo domain for new interfaces, in particular not for varlink ones

&triggered_by);
if (r < 0)
return log_error_errno(r, "Failed to get TriggeredBy property of %s: %s",
name, bus_error_message(&error, r));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

humpf, not all varlink services are socket activated. for example journald's varlink interface does not involve socket activation. hence, i find this really a bit too magic.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure it doesn't cover everything, but it's a start? And we could just add a socket unit for that one, no?

@poettering

Copy link
Copy Markdown
Member

or to say this differently: i wanted the service iface to be what LogControl was for D-Bus, but with a bit wider focus, i.e. support a bunch of props that a service needs to support, not just logging.

@bluca

bluca commented Feb 8, 2026 •

Copy link
Copy Markdown
Member Author

I dont get it, what does this new iface do that the existing one doesnt already?

  • string based instead of integer based - so much nicer as a user
  • getter for log level
  • log target
  • identifier
  • same domain and pattern as the existing dbus one, so that it's easier to find and adopt

or to say this differently: i wanted the service iface to be what LogControl was for D-Bus, but with a bit wider focus, i.e. support a bunch of props that a service needs to support, not just logging.

the service interface has io.systemd in the name, which to a casual observer sounds like it means it's specific to systemd code/integration, rather than a generic one. It doesn't even have to be restricted to services, it's conceivable that a oneshot program but with a long runtime might also want to implement this, it's not really strictly tied to systemd services only.

Also the fact that org.freedesktop.LogControl already exists is an advantage, because it makes it easier to discover, and makes it obvious that it's the same thing, just over a different protocol

@poettering

Copy link
Copy Markdown
Member

string based instead of integer based - so much nicer as a user

the call could be updated to allow both...

Also the fact that org.freedesktop.LogControl already exists is an advantage, because it makes it easier to discover, and makes it obvious that it's the same thing, just over a different protocol

I am not convinced that is a good reason, I am pretty sure we should get the fdo terminology out of the concept.

@poettering

Copy link
Copy Markdown
Member

anyway, still sure the existing valrink interface should be extended.

@bluca bluca closed this Oct 31, 2026
@bluca
bluca deleted the service_log_level_varlink branch October 31, 2026 12:42
@github-actions github-actions Bot removed the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants