Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

journalctl: make "--user --unit" works as "--user-unit" #1621

Closed
tomty89 opened this issue Oct 20, 2015 · 7 comments

Comments

6 participants
@tomty89
Copy link
Contributor

commented Oct 20, 2015

Currently if I run journalctl --user --unit $SOME_UNIT I will just get "No entries". Although there is the "--user-unit" option, it seems a bit dumb to me that "--user --unit" doesn't do the same thing. Would it be possible/nice to add a switch or something to "--unit" so that when "--user" is used, it matches "_SYSTEMD_USER_UNIT=" and "_UID=" instead of "_SYSTEMD_UNIT=UNIT"?

@poettering

This comment has been minimized.

Copy link
Member

commented Oct 20, 2015

Yeah, probably makes sense.

@oconnor663

This comment has been minimized.

Copy link

commented Mar 30, 2016

Is there any particular reason --unit doesn't match both _SYSTEMD_UNIT and _SYSTEMD_USER_UNIT? It took me a while to figure out why my logs weren't showing up >.<

@poettering

This comment has been minimized.

Copy link
Member

commented Apr 1, 2016

@oconnor663 well, most sys admins might be quite confused if "journalctl -u httpd" also gives them the output of any user service by the same name, just because a user decided to name a service that way.

@oconnor663

This comment has been minimized.

Copy link

commented Apr 1, 2016

Hmm, I wonder if there's an easy way to prevent other new users from making my mistake. Maybe add an explicit mention in the --unit documentation that it ignores user-level services, so that users don't have to keep reading to --user-unit to find that out? Anyway, I'll stop hijacking this issue :)

poettering added a commit to poettering/systemd that referenced this issue Apr 25, 2016

journalctl: turn --unit= in combination with --user into --user-unit=
Let's be nice to users, and let's turn the nonsensical "--unit=… --user" into
"--user-unit=…" which the user more likely meant.

Fixes systemd#1621

poettering added a commit to poettering/systemd that referenced this issue Apr 25, 2016

journalctl: turn --unit= in combination with --user into --user-unit=
Let's be nice to users, and let's turn the nonsensical "--unit=… --user" into
"--user-unit=…" which the user more likely meant.

Fixes systemd#1621

@keszybz keszybz closed this in 52051dd Apr 25, 2016

@markstos

This comment has been minimized.

Copy link
Contributor

commented Jun 23, 2016

Thanks for this fix! I'm using 229 and only today discovered that --user --unit did not mean --user-unit like I thought. I look forward now to v230.

@LeGEC

This comment has been minimized.

Copy link

commented Oct 25, 2018

Hello

Can someone please indicate in what version this feature has been released ?

From what I see on our systems : we are running systemd v232 on debian/stretch systems, and "journalctl --user --unit blah" does not output the same thing as "journalctl --user-unit blah"

# system and systemd versions :
$ lsb_release -a
Distributor ID:	Debian
Description:	Debian GNU/Linux 9.5 (stretch)
Release:	9.5
Codename:	stretch

$ systemd --version
systemd 232
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN

# journalctl output :
$ journalctl --user --unit db.service
No journal files were found.
-- No entries --

$ journalctl --user-unit db.service
-- Logs begin at Wed 2018-10-24 02:24:36 CEST, end at Thu 2018-10-25 15:47:39 CEST. --
oct. 25 01:11:51 oracmp systemd[21313]: Starting Database Checker...
oct. 25 01:11:51 oracmp systemd[21313]: Started Database Checker.
oct. 25 01:11:51 oracmp systemd[21313]: Starting Database Checker...
oct. 25 01:11:52 oracmp systemd[21313]: Started Database Checker.
@keszybz

This comment has been minimized.

Copy link
Member

commented Oct 25, 2018

@LeGEC this might be something to report in your distro. Upstream the code was merged to systemd-v230.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.