journalctl missing grep

Bug #1856330 reported by pi-rho
20
This bug affects 10 people
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
ProcVersionSignature: Ubuntu 5.3.0-22.24+system76~1573660262~18.04~d11b582~dev-generic 5.3.7
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-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-5.3.0-22-generic root=UUID=25721613-9f9a-4e8d-ac61-a6869852d0e2 ro ipv6.disable=1 usbhid.quirks=0x1B1C:0x1B13:0x400 quiet splash vt.handoff=1
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.asset.tag: To be filled by O.E.M.
dmi.board.name: H87-PLUS
dmi.board.vendor: ASUSTeK COMPUTER INC.
dmi.board.version: Rev X.0x
dmi.chassis.asset.tag: Asset-1234567890
dmi.chassis.type: 3
dmi.chassis.vendor: System76, Inc.
dmi.chassis.version: Desktop
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvr0411:bd06/28/2013:svnSystem76,Inc.:pnWildDogPerformance:pvrwilp10:rvnASUSTeKCOMPUTERINC.:rnH87-PLUS:rvrRevX.0x:cvnSystem76,Inc.:ct3:cvrDesktop:
dmi.product.family: ASUS MB
dmi.product.name: Wild Dog Performance
dmi.product.sku: All
dmi.product.version: wilp10
dmi.sys.vendor: System76, Inc.
mtime.conffile..etc.systemd.resolved.conf: 2018-10-08T15:18:41.655856

Revision history for this message
pi-rho (pi-rho) wrote :
Dan Streetman (ddstreet)
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
Revision history for this message
Dan Streetman (ddstreet) wrote :

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.

Changed in systemd (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.