]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: add support for LogFilterPatterns for show command
authorQuentin Deslandes <qde@naccy.de>
Wed, 14 Sep 2022 17:17:19 +0000 (18:17 +0100)
committerQuentin Deslandes <qde@naccy.de>
Thu, 15 Dec 2022 09:57:39 +0000 (09:57 +0000)
Parse DBus structure send by LogFilterPatterns to print it in systemctl
show.

src/systemctl/systemctl-show.c

index 77dd075eb3074e3bdb3d32bc4d01edbded3347e3..f78cf307cac515fdac0d81ae44b5170f88bf8474 100644 (file)
@@ -1650,6 +1650,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;