logs-show.c: show all messages for a slice

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2013-09-30 23:58:44 +02:00
parent ceadabb102
commit 69ae3ee07e
2 changed files with 22 additions and 3 deletions

3
TODO
View file

@ -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

View file

@ -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;
}