journalctl-mode icon indicating copy to clipboard operation
journalctl-mode copied to clipboard

Major mode to view journalctl's output in Emacs

  • Journalctl-mode

This is a major-mode for emacs to view systemd's journalctl output in emacs. The output is split into chunks for performance reasons.

Fontification is provided and may be customized.

At the moment it is still in very early development. Please give feedback on any problems that occure.

[[./journalctl-mode.08.gif]]

** Installation

*** With use-package

You can install journalctl-mode from MELPA, for example with: #+BEGIN_SRC emacs-lisp (use-package journalctl-mode :ensure t) #+END_SRC

*** Manual

Clone the project or download journalctl-mode.el and put that file to a load-path.

Put
down #+BEGIN_SRC emacs-lisp ( require 'journalctl-mode) #+END_SRC

in your .emacs file.

** Usage

At the moment there are to functions provided to call journalctl:

  • journalctl: will ask for commandline options like "-xe" and show the output in the \ast{}journalctl\ast{} buffer.
  • journalctl-boot: will provide you with the list of boots in the journal. You can choose one and view it in the buffer.
  • journalctl-unit: will provide you with the list of units . You can choose one and view related logs in the buffer.
  • journalctl-user-unit: will provide you with the list of user-units . You can choose one and view related logs in the buffer.

In journalctl-mode you can navigate between the cunks with "n" (next chunk) and "p" (previous chunk). I also redefined C-v and M-v so that it will move to the next chunk, when you have reached the bottom or top of the buffer.

You can add options from journalctl-mode with "+ +" and remove them with "- -".

There are also some keybindings to add options:

  • "+ r" : Reverse output (--reverse).

  • "+ x": Augment log lines with explanation texts from the message catalog. (--catalog).

  • "+ s": Show messages from system services and the kernel only (--system).

  • "+ u": Show messages from service of current user only (--user).

  • "+ k": Show kernel message only (--dmesg). This applies "-b".

  • "+ p" prompt for priority range and show the respective messages (--priority).

  • "+ S": Show messages since given date and / or time (--since).

  • "+ U": Show messages until given date and / or time (--until).

When you replace the "+" with a "-" for each option (like "- r") you remove it.

You can edit the current options with "e".

You can grep on the current output of journalctl with "+ g". You will be asked for a pattern to grep.

You can remove all filters (grep) with "- -".

Type "q" to kill the "\ast{}journalctl\ast{}" buffer.