Systemd journal monitoring and notification tool with priority filtering, pattern matching and security violation detection
Project description
journalcheck
Systemd journal monitoring and notification tool with priority filtering, pattern matching and security violation detection.
Inspired by logcheck, but designed for systemd's journal with output that can be piped to other programs for notifications, monitoring, or alerting.
Key Differences from logcheck
- Priority-based filtering: Filter messages by systemd priority levels (emerg, alert, crit, err, warning, notice, info, debug) - logcheck only supports pattern matching
- Per-service priority control: Set different priority thresholds for different services without writing individual ignore patterns
- Flexible output: Pipe to any command, send via email, or output to stdout - not limited to email only
- JSON output: Machine-readable format for integration with monitoring systems
- Cursor-based tracking: Only process new entries since last run using systemd journal cursors
Features
- Priority-based filtering (emerg, alert, crit, err, warning, notice, info, debug)
- Per-identifier priority configuration
- Regex pattern matching for identifiers (case-sensitive; (?i) is supported)
- Regex pattern matching for ignore and violations patterns (always case-insensitive)
- Ignore patterns: Must match the entire message (implicit anchors)
- Violation patterns: Can match anywhere in the message (substring match)
- Two-level pattern hierarchy:
- Violations: Always shown (e.g., failed logins, security events)
- Ignore: Suppress matching messages (exact match)
- Pre-configured violation patterns for common services (sshd, sudo, su, smartd)
- Cursor-based tracking (only process new entries)
- Multiple output formats (short, json)
- Modular configuration via
/etc/journalcheck.yamland/etc/journalcheck.d/*.yaml
Installation
From PyPI
pip install journalcheck
From Debian package
Download the .deb file from the releases page and install:
sudo dpkg -i journalcheck_*.deb
via APT Repository
- download the public key:
curl -fsSL https://gms1.github.io/journalcheck/apt/public.gpg | sudo gpg --dearmor -o /usr/share/keyrings/journalcheck-archive-keyring.gpg
- register the apt repository
echo "deb [signed-by=/usr/share/keyrings/journalcheck-archive-keyring.gpg] https://gms1.github.io/journalcheck/apt ./" | sudo tee /etc/apt/sources.list.d/journalcheck.list
- install this package
sudo apt update && sudo apt install journalcheck
From source
pip install -e .
Configuration
Main config: /etc/journalcheck.yaml
Additional configs: /etc/journalcheck.d/*.yaml (merged automatically)
Example:
priority: warning
format: short
# Optional: pipe output to a command
output_command: "notify-send 'Journal Alert'"
# Optional: send output via email
email_to: "admin@example.com"
email_subject: "Journal Alerts"
identifiers:
ssh: # Exact match
priority: info
ignore:
- ".*session opened.*" # Full match: must match entire message
- ".*session closed.*"
violations:
- "Failed password" # Substring: matches anywhere in message
/^(?i)cron$/: # Match both "cron" and "CRON" using case-insensitive regex
priority: notice
ignore:
- ".*session opened.*"
- ".*session closed.*"
/^.*$/: # Any other identifier
violations:
- (error|failed)
Output Options:
- If
output_commandis set, output will be piped to that command - If
email_tois set, output will be sent via email using themailcommand - If neither is set, output goes to stdout by (default), except if running as systemd service
Default Violations
The following identifiers have pre-configured violation patterns that are automatically included:
- sshd: Failed password, Invalid user, Connection closed by authenticating user, etc.
- sudo: authentication failure, user NOT in sudoers, incorrect password attempt
- su: FAILED su, authentication failure
- smartd: SMART Failure, Attribute.*failed, Error.*occurred
- kernel: I/O error, Buffer I/O error, end_request: I/O error
You can add additional violations to these identifiers - they will be appended to the defaults.
Usage
Basic usage
journalcheck
Filter output
journalcheck | grep ssh
Save to file
journalcheck > /var/log/journal-alerts.log
Send via email
journalcheck | mail -s "Journal Alerts" admin@example.com
Run via systemd timer
The package includes systemd service and timer units for automated checking.
Enable the timer:
sudo systemctl enable --now journalcheck.timer
Check timer status:
sudo systemctl status journalcheck.timer
sudo systemctl list-timers journalcheck.timer
Customize the schedule: The default schedule is hourly. To change it:
sudo systemctl edit journalcheck.timer
Add your custom schedule:
[Timer]
OnCalendar=daily
See systemd.time(7) for schedule syntax.
License
MIT License - see LICENSE file for details.
Repository
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file journalcheck-1.0.3.tar.gz.
File metadata
- Download URL: journalcheck-1.0.3.tar.gz
- Upload date:
- Size: 21.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
412e4695dde52bbf6a0743b7e5910797f40d01313d23147411f376490d2d52de
|
|
| MD5 |
84b6f918bf794301ab35549613719e65
|
|
| BLAKE2b-256 |
c76d34d644cb061cd4c955fd02c457a1f271220d6a9e4ace12564f35901d086c
|
Provenance
The following attestation bundles were made for journalcheck-1.0.3.tar.gz:
Publisher:
release.yml on gms1/journalcheck
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
journalcheck-1.0.3.tar.gz -
Subject digest:
412e4695dde52bbf6a0743b7e5910797f40d01313d23147411f376490d2d52de - Sigstore transparency entry: 1102887079
- Sigstore integration time:
-
Permalink:
gms1/journalcheck@4b958392f717d14bb064536d13824195fcd9b76e -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/gms1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4b958392f717d14bb064536d13824195fcd9b76e -
Trigger Event:
push
-
Statement type:
File details
Details for the file journalcheck-1.0.3-py3-none-any.whl.
File metadata
- Download URL: journalcheck-1.0.3-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bd0e59ed42c08ed64c38611b805ac1f711117f9a6ec8a592d0d0b1845e7d467
|
|
| MD5 |
b46d6148e64124e20c4eb114df7f1523
|
|
| BLAKE2b-256 |
9a288bd848c81127577acca80fd756f9c24ace3cde90c1ae54eb13ed67473400
|
Provenance
The following attestation bundles were made for journalcheck-1.0.3-py3-none-any.whl:
Publisher:
release.yml on gms1/journalcheck
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
journalcheck-1.0.3-py3-none-any.whl -
Subject digest:
6bd0e59ed42c08ed64c38611b805ac1f711117f9a6ec8a592d0d0b1845e7d467 - Sigstore transparency entry: 1102887102
- Sigstore integration time:
-
Permalink:
gms1/journalcheck@4b958392f717d14bb064536d13824195fcd9b76e -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/gms1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4b958392f717d14bb064536d13824195fcd9b76e -
Trigger Event:
push
-
Statement type: