journald-send Documentation

📜 journald-send

made-in-vietnam journald-send ReadTheDocs Common Changelog

A thin Python library to write messages to journald (Linux system logging) using its native protocol.

💡 Features

  • Simple functions to log messages directly to journald using its native protocol.

  • Best for structured logging.

  • Pure-Rust (not depending on libc, although PyO3 may include it when linking with CPython).

  • Not depend on C-based libsystemd (as journald-send focuses on writing to journald, not reading nor interacting with systemd).

🤔 Motivation

Previously, I used systemd-python, but this library was slow to release, and its support for Python 3.14, especially in free-threaded mode, was unknown. So I developed journald-send to support Python 3.14 and free-threaded mode.

It is implemented using pure-Rust rustix and memfd crates, which provide an elegant, Rust-ergonomic API compared to libc.

📦 Installation

Install via pip:

pip install journald-send

Or using uv:

uv add journald-send

🐍 Usage

Import and use the send function:

import journald_send
journald_send.send('Hello, journald!')

Or use the JournalHandler for Python logging framework integration:

import logging
from journald_send.log_handler import JournalHandler

log = logging.getLogger('my-app')
log.addHandler(JournalHandler(SYSLOG_IDENTIFIER='my-app'))
log.warning('Something happened')

📁 Examples

See examples in the examples folder.

📖 Documentation

Full documentation is available at Read the Docs.

🤝 Contributing

Contributions welcome; open an issue or PR.

🔧 Development

Prerequisites

  • Python >= 3.12

  • Rust toolchain

  • uv package manager

Setup

uv sync --all-groups

Build

uv run maturin develop

Run Tests

uv run pytest

Build Documentation

just docs

🙏 Acknowledgement

This project learned from tracing-journald library for how to talk with journald at low level.