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.
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)
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)))
- 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.
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.
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 | Action |
---|---|
n | Load next chunk of journalctl output |
p | Load previous chunk of journalctl output |
C-v | Scroll up in the buffer |
M-v | Scroll down in the buffer |
q | Quit journalctl mode |
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.
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/.
For support, feedback, or to contribute to the project, please visit the homepage at https://github.com/SebastianMeisel/journalctl-mode.
Thanks to all contributors and users for their support and feedback which continue to improve this mode.