18

GitHub - SebastianMeisel/journalctl-mode: Major mode to view journalctl'...

 3 years ago
source link: https://github.com/SebastianMeisel/journalctl-mode
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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.

Installation

With use-package

You can install `journalctl-mode` from MELPA, for example with:

(use-package journalctl-mode
:ensure t)

Manual

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

Put down

( require 'journalctl-mode) 

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 ∗journalctl∗ 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 “∗journalctl∗” buffer.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK