summaryrefslogtreecommitdiff
path: root/src/journal/journalctl.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-02-19 22:40:26 +0100
committerLennart Poettering <lennart@poettering.net>2018-02-20 22:36:01 +0100
commite79d0b59c8d01d35343b21d02d997d2579c32f27 (patch)
tree2999a5c8332215ae77c1b08c48e32b800c690f70 /src/journal/journalctl.c
parent2e10cc5649193eef5117fa5186869fbb74b0481e (diff)
downloadsystemd-e79d0b59c8d01d35343b21d02d997d2579c32f27.tar.gz
journalctl: improve hint about lack of access for --user-unit=...
When running journalctl --user-unit=foo as an unprivileged user we could get the usual hint: Hint: You are currently not seeing messages from the system and other users. Users in groups 'adm', 'systemd-journal', 'wheel' can see all messages. ... But with --user-unit our filter is: (((_UID=0 OR _UID=1000) AND OBJECT_SYSTEMD_USER_UNIT=foo.service) OR ((_UID=0 OR _UID=1000) AND COREDUMP_USER_UNIT=foo.service) OR (_UID=1000 AND USER_UNIT=foo.service) OR (_UID=1000 AND _SYSTEMD_USER_UNIT=foo.service)) so we would never see messages from other users. We could still see messages from the system. In fact, on my machine the only messages with OBJECT_SYSTEMD_USER_UNIT= are from the system: journalctl $(journalctl -F OBJECT_SYSTEMD_USER_UNIT|sed 's/.*/OBJECT_SYSTEMD_USER_UNIT=\0/') Thus, a more correct hint is that we cannot see messages from the system. Make it so. Fixes #7887.
Diffstat (limited to 'src/journal/journalctl.c')
-rw-r--r--src/journal/journalctl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 0aa4c1f772..02715142e9 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -972,8 +972,7 @@ static int parse_argv(int argc, char *argv[]) {
return -EINVAL;
}
- if (!strv_isempty(arg_system_units) && (arg_journal_type == SD_JOURNAL_CURRENT_USER)) {
-
+ if (!strv_isempty(arg_system_units) && arg_journal_type == SD_JOURNAL_CURRENT_USER) {
/* Specifying --user and --unit= at the same time makes no sense (as the former excludes the user
* journal, but the latter excludes the system journal, thus resulting in empty output). Let's be nice
* to users, and automatically turn --unit= into --user-unit= if combined with --user. */
@@ -2241,7 +2240,8 @@ int main(int argc, char *argv[]) {
goto finish;
}
- r = journal_access_check_and_warn(j, arg_quiet);
+ r = journal_access_check_and_warn(j, arg_quiet,
+ !(arg_journal_type == SD_JOURNAL_CURRENT_USER || arg_user_units));
if (r < 0)
goto finish;