<commit_before>journald-python
===============

Python module for native access to the journald facilities in recent versions of systemd. In particular, this capability includes passing key/value pairs as fields that journald can use for filtering.

Installation
============

On Fedora 17+:

    sudo yum install git python-pip gcc python-devel systemd-devel
    pip-python install git+http://github.com/davidstrauss/journald-python.git#egg=journald

Usage
=====

Quick example:

    import journald
    journald.send('MESSAGE=Hello world.')
    journald.send('MESSAGE=Hello, again, world.', 'FIELD2=Greetings!', 'FIELD3=Guten tag.')
    journald.send('ARBITRARY=anything', 'FIELD3=Greetings!')

Notes:

 * Each argument must be in the form of a KEY=value pair, environmental variable style.
 * Unlike the native C version of journald's sd_journal_send(), printf-style substitution is not supported. Perform any substitution using Python's % operator or .format() capabilities first.
 * The base message is usually sent in the form MESSAGE=hello. The MESSAGE field is, however, not required.
 * Invalid or zero arguments results in nothing recorded in journald.

Viewing Output
==============

Quick way to view output with all fields as it comes in:

    sudo journalctl -f --output=json

Test Builds (for Development)
=============================

    python setup.py build
    cd builds/lib.*
    python<commit_msg>Wrap README to 80 lines<commit_after>journald-python
===============

Python module for native access to the journald facilities in recent
versions of systemd. In particular, this capability includes passing
key/value pairs as fields that journald can use for filtering.

Installation
============

On Fedora 17+:

    sudo yum install git python-pip gcc python-devel systemd-devel
    pip-python install git+http://github.com/davidstrauss/journald-python.git#egg=journald

Usage
=====

Quick example:

    import journald
    journald.send('MESSAGE=Hello world')
    journald.send('MESSAGE=Hello, again, world', 'FIELD2=Greetings!', 'FIELD3=Guten tag')
    journald.send('ARBITRARY=anything', 'FIELD3=Greetings!')

Notes:

 * Each argument must be in the form of a KEY=value pair,
   environmental variable style.
 * Unlike the native C version of journald's sd_journal_send(),
   printf-style substitution is not supported. Perform any
   substitution using Python's % operator or .format() capabilities
   first.
 * The base message is usually sent in the form MESSAGE=hello. The
   MESSAGE field is, however, not required.
 * Invalid or zero arguments results in nothing recorded in journald.

Viewing Output
==============

Quick way to view output with all fields as it comes in:

    sudo journalctl -f --output=json

Test Builds (for Development)
=============================

    python setup.py build
    cd builds/lib.*
    python
{'fraction_non_alphanumeric': 0.12124388539482879, 'fraction_numerical': 0.0041928721174004195, 'mean_word_length': 4.4120982986767485, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3238762', 'n_tokens_mistral': 810, 'n_tokens_neox': 755, 'n_words': 311}