Skip to content

SebastianMeisel/journalctl-mode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

journalctl-mode.el

Introduction

This Emacs major mode is designed for viewing the output from systemd’s journalctl within Emacs. It provides a convenient way to interact with journalctl logs, including features like fontification, chunked loading for performance, and custom keyword highlighting.

journalctl.v1.1.gif

Installation

To install, place journalctl-mode.el in your load-path and add the following to your .emacs file:

(require 'journalctl-mode)

Alternatively, you can install journalctl-mode using the use-package macro with Quelpa for automatic installation from the GitHub repository:

(use-package journalctl-mode
  :ensure t)

Define a global key

It might be a good idea to define a global key to journalctl with:

(global-set-key (kbd "C-c t") 'journalctl)

or with use-package:

(use-package journalctl-mode
  :ensure t
  :bind (("C-c t" . journalctl)))

Features

  • Fontification: Customize the appearance of log levels with faces.
  • Chunked Loading: Load journalctl output in manageable chunks for better performance.
  • Keyword Highlighting: Define custom keywords for error, warning, and other log levels.
  • Follow Mode: Simulate tail -f functionality to keep up with new log entries.

Usage

Once installed, journalctl-mode can be invoked with M-x journalctl. The mode provides a transient interface for journalctl command-line options, allowing for dynamic and flexible log viewing.

Customization

Customize the mode to your liking by setting the following variables:

  • journalctl-chunk-size: Number of lines per chunk (default 250).
  • journalctl-error-keywords: List of keywords to highlight as errors.
  • journalctl-warn-keywords: List of keywords to highlight as warnings.
  • journalctl-starting-keywords: Keywords for starting processes.
  • journalctl-finished-keywords: Keywords for finished processes.
  • journalctl-follow-freq: Frequency for updating in follow mode.
  • journalctl-follow-lines: Number of lines to show in follow mode.
  • journalctl-default-options: List of default options for journalctl on start.

Key Bindings

KeyAction
nLoad next chunk of journalctl output
pLoad previous chunk of journalctl output
C-vScroll up in the buffer
M-vScroll down in the buffer
qQuit journalctl mode

Other Packages

There is another package journalctl (rather than journalctl-mode) by James Ferguson that fetches and interleaves JSON data using multiple simultaneous asynchronous journalctl queries, while mine offers a UI for query-building and chunked synchronous data loading.

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Support

For support, feedback, or to contribute to the project, please visit the homepage at https://github.com/SebastianMeisel/journalctl-mode.

Acknowledgements

Thanks to all contributors and users for their support and feedback which continue to improve this mode.

About

Major mode to view journalctl's output in Emacs

Resources

License

Stars

Watchers

Forks

Packages

No packages published