9

My journalctl is littered with gnome-session warnings. I've tracked down the issue to Google Chrome, and the warning is relatively harmless. However, it's flooded my journal output, and frankly I won't be able to find what I need if I do need to check it.

May 30 12:13:49 hostname gnome-session[1347]: Window manager warning: meta_window_activate called by a pager with a 0 timestamp; the pager needs to be fixed.

Frankly, it's a Chrome issue and I'll leave it at that. But is there a way to make the journalctl command suppress output from a certain process? I'd like to just disable gnome-session logging altogether.

Thell
  • 5,883
  • 31
  • 55
dook
  • 1,213
  • 1
  • 13
  • 30

1 Answers1

7

This question seems like it would be a better fit on Unix & Linux.

Regardless though, being able to filter out units when perusing logs can easily be done piping to grep -v even when following (with grep's --line-buffered param) like

journalctl -f | grep --line-buffered -v "gnome"

That still sucks because now there is no helpful coloring. Constructing the command arguments for journalctl gives a much nicer experience.

JARGS=`journalctl -F _COMM | sed -e 's/gnome.*//' -e 's/^/_COMM=/' | xargs`
journalctl -a -f $JARGS

Now follow works as nicely as paging while hiding gnome lines in less using $!gnome. Woot!

It is a shame systemctl and journalctl don't allow regex matching for inclusion/exclusion.


On a personal use system (which I'm guessing your on because of the gnome-session annoyance) there are a few settings that may be useful to setup.

Edit the system journald.conf to

  1. Split the log by boot.
    verify Storage= persist or auto (default).
    and create sudo mkdir -p /var/log/journal
  2. Limit storage use by time.
    MaxRetentionSec=1week

Reboot to effectively restart the systemd-journald.service.

Then you can use

journalctl -a -b -f $JARGS # -b to limit to current boot 

or whatever args you desire without the unwanted gnome-session stuff.

Community
  • 1
  • 1
Thell
  • 5,883
  • 31
  • 55
  • When using the `$JARGS` trick (with `gnome` being filtered out for instance), the `kernel` records aren't shown unfortunately. Any suggestions? (By kernel record I mean for instance: `Dec 15 21:59:17 service-ad-1-1.localdomain kernel: RTNL: assertion failed at net/core/net_namespace.c (187)`) – Stepan Vavra Dec 15 '16 at 23:14
  • Agree with @Thell "its a shame" no regex on --unit selection or possible feature journalctl --unit-exclude is annoying. – Cymatical Sep 21 '21 at 20:20
  • Interesting - journalctl gnu mashup piped to journalcti with a variable. Like grep piped to grep :) – Cymatical Sep 21 '21 at 20:25