journalctl missing grep
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
systemd (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Bionic |
Won't Fix
|
Undecided
|
Unassigned | ||
Disco |
Won't Fix
|
Undecided
|
Unassigned | ||
Eoan |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
the man page for journalctl and the usage (journalctl --help) advertise an option (-g, --grep=) to grep the MESSAGE portion of events for a pcre pattern. journalctl is linked against libpcre, but doesn't recognize the option when used.
$ journalctl -g dhcp
journalctl: invalid option -- 'g'
ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: systemd 237-3ubuntu10.33
ProcVersionSign
Uname: Linux 5.3.0-22-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.9
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Fri Dec 13 09:26:08 2019
MachineType: System76, Inc. Wild Dog Performance
ProcEnviron:
TERM=xterm-
PATH=(custom, no user)
XDG_RUNTIME_
LANG=en_US.UTF-8
SHELL=/bin/bash
ProcKernelCmdLine: BOOT_IMAGE=
SourcePackage: systemd
UpgradeStatus: Upgraded to bionic on 2018-10-05 (433 days ago)
dmi.bios.date: 06/28/2013
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: 0411
dmi.board.
dmi.board.name: H87-PLUS
dmi.board.vendor: ASUSTeK COMPUTER INC.
dmi.board.version: Rev X.0x
dmi.chassis.
dmi.chassis.type: 3
dmi.chassis.vendor: System76, Inc.
dmi.chassis.
dmi.modalias: dmi:bvnAmerican
dmi.product.family: ASUS MB
dmi.product.name: Wild Dog Performance
dmi.product.sku: All
dmi.product.
dmi.sys.vendor: System76, Inc.
mtime.conffile.
Changed in systemd (Ubuntu Eoan): | |
status: | New → Fix Released |
Changed in systemd (Ubuntu Disco): | |
status: | New → Won't Fix |
Changed in systemd (Ubuntu Bionic): | |
status: | New → Won't Fix |
Unfortunately, systemd in Bionic and Disco was built without the pcre2 library, and that's what journalctl uses to implement --grep. So before Eoan, journalctl --grep will fail with:
"Compiled without pattern matching support"
Since adding this support now would pull in an additional dependency to the systemd package, fixing this bug would mean breaking automatic updates for everyone using systemd (on Bionic or Disco) but without libpcre2 installed, since a package won't be automatically updated if it requires new dependencies that aren't currently installed.
Also unfortunately, the journalctl -g option was left out of the options string, so it prints "invalid option" as you mentioned; that is trivial to fix, but won't actually make journalctl grep work, since it would just change from "invalid option" to "compile without pattern matching support". So while the -g error message for journalctl in Bionic is a bit confusing, I don't think it's worth a patch just to slightly improve the error message without actually getting --grep working.
Please note that --grep (and -g) works starting in Eoan.
Also, I'll mention that you can still simply pipe journalctl output into the 'grep' tool; it's a bit less efficient but should still work.
Sorry.