summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO3
-rw-r--r--src/shared/logs-show.c22
2 files changed, 22 insertions, 3 deletions
diff --git a/TODO b/TODO
index df4813cc46..c1f6e5ad62 100644
--- a/TODO
+++ b/TODO
@@ -60,9 +60,6 @@ Features:
* libdsystemd-bus should expose utf8 validation calls
-* When using "systemd status" on a slice unit also show all messages
- matching _SYSTEMD_SLICE= not just _SYSTEMD_UNIT=
-
* After coming back from hibernation reset hibernation swap partition
* If we try to find a unit via a dangling symlink generate a clean
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 2dd5025bc3..7bb19b4006 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -1048,6 +1048,16 @@ int add_matches_for_unit(sd_journal *j, const char *unit) {
(r = sd_journal_add_match(j, m4, 0))
);
+ if (r == 0 && endswith(unit, ".slice")) {
+ char *m5 = strappend("_SYSTEMD_SLICE=", unit);
+
+ /* Show all messages belonging to a slice */
+ (void)(
+ (r = sd_journal_add_disjunction(j)) ||
+ (r = sd_journal_add_match(j, m5, 0))
+ );
+ }
+
return r;
}
@@ -1087,6 +1097,18 @@ int add_matches_for_user_unit(sd_journal *j, const char *unit, uid_t uid) {
(r = sd_journal_add_match(j, muid, 0)) ||
(r = sd_journal_add_match(j, "_UID=0", 0))
);
+
+ if (r == 0 && endswith(unit, ".slice")) {
+ char *m5 = strappend("_SYSTEMD_SLICE=", unit);
+
+ /* Show all messages belonging to a slice */
+ (void)(
+ (r = sd_journal_add_disjunction(j)) ||
+ (r = sd_journal_add_match(j, m5, 0)) ||
+ (r = sd_journal_add_match(j, muid, 0))
+ );
+ }
+
return r;
}