diff options
author | Quentin Deslandes <qde@naccy.de> | 2022-09-14 19:17:19 +0200 |
---|---|---|
committer | Quentin Deslandes <qde@naccy.de> | 2022-12-15 10:57:39 +0100 |
commit | c00b95d5e976ff51e83e58cfddb605c950ae31ec (patch) | |
tree | 243c1c09e0ba8eca3f01eb0b00350a0b243353da /src/systemctl/systemctl-show.c | |
parent | journal: log filtering options support in PID1 (diff) | |
download | systemd-c00b95d5e976ff51e83e58cfddb605c950ae31ec.tar.xz systemd-c00b95d5e976ff51e83e58cfddb605c950ae31ec.zip |
systemctl: add support for LogFilterPatterns for show command
Parse DBus structure send by LogFilterPatterns to print it in systemctl
show.
Diffstat (limited to 'src/systemctl/systemctl-show.c')
-rw-r--r-- | src/systemctl/systemctl-show.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/systemctl/systemctl-show.c b/src/systemctl/systemctl-show.c index 77dd075eb3..f78cf307ca 100644 --- a/src/systemctl/systemctl-show.c +++ b/src/systemctl/systemctl-show.c @@ -1651,6 +1651,24 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m bus_print_property_value(name, expected_value, flags, affinity); return 1; + } else if (streq(name, "LogFilterPatterns")) { + int is_allowlist; + const char *pattern; + + r = sd_bus_message_enter_container(m, SD_BUS_TYPE_ARRAY, "(bs)"); + if (r < 0) + return bus_log_parse_error(r); + + while ((r = sd_bus_message_read(m, "(bs)", &is_allowlist, &pattern)) > 0) + bus_print_property_valuef(name, expected_value, flags, "%s%s", is_allowlist ? "" : "~", pattern); + if (r < 0) + return bus_log_parse_error(r); + + r = sd_bus_message_exit_container(m); + if (r < 0) + return bus_log_parse_error(r); + + return 1; } else if (streq(name, "MountImages")) { _cleanup_free_ char *paths = NULL; |