All Projects → systemd → Ejournald

systemd / Ejournald

A Erlang binding to the systemd journal C API

Programming Languages

erlang
1774 projects

Labels

Projects that are alternatives of or similar to Ejournald

journal
a blogging platform built on [matrix]
Stars: ✭ 71 (+184%)
Mutual labels:  journal
Papaja
papaja (Preparing APA Journal Articles) is an R package that provides document formats to produce complete APA manuscripts from RMarkdown-files (PDF and Word documents) and helper functions that facilitate reporting statistics, tables, and plots.
Stars: ✭ 422 (+1588%)
Mutual labels:  journal
Rescience
The ReScience journal. Reproducible Science is Good. Replicated Science is better.
Stars: ✭ 634 (+2436%)
Mutual labels:  journal
Lwext4
ext2/ext3/ext4 filesystem library for microcontrollers
Stars: ✭ 270 (+980%)
Mutual labels:  journal
Rednotebook
RedNotebook is a cross-platform journal
Stars: ✭ 336 (+1244%)
Mutual labels:  journal
Sol Journal
✎ Simple, personal journaling progressive web app
Stars: ✭ 470 (+1780%)
Mutual labels:  journal
Emojilog
A nice little diary for emoji logs.
Stars: ✭ 12 (-52%)
Mutual labels:  journal
Joss
The Journal of Open Source Software
Stars: ✭ 779 (+3016%)
Mutual labels:  journal
Gojot
A command-line journal that is distributed and encrypted, making it easy to jot notes 📓
Stars: ✭ 340 (+1260%)
Mutual labels:  journal
Vscodenotebook
📝 Use VS Code as a reliable note-taking/journal application
Stars: ✭ 584 (+2236%)
Mutual labels:  journal
Akka Persistence Jdbc
Asynchronously writes journal and snapshot entries to configured JDBC databases so that Akka Actors can recover state
Stars: ✭ 271 (+984%)
Mutual labels:  journal
Lifelong Learning
✅ ✅ ✅ A massive repo filled with notes on everything from coding to philosophy to psychology to marketing to product
Stars: ✭ 297 (+1088%)
Mutual labels:  journal
Jrnl
Collect your thoughts and notes without leaving the command line.
Stars: ✭ 5,126 (+20404%)
Mutual labels:  journal
disk-lru-cache
💾 Disk LRU cache with persisted journal
Stars: ✭ 21 (-16%)
Mutual labels:  journal
Friends
Spend time with the people you care about. Introvert-tested. Extrovert-approved.
Stars: ✭ 737 (+2848%)
Mutual labels:  journal
wassup
Personal assistant to help you save your personal memories and emotions together, securely
Stars: ✭ 58 (+132%)
Mutual labels:  journal
Git Journal
The Git Commit Message and Changelog Generation Framework 📖
Stars: ✭ 456 (+1724%)
Mutual labels:  journal
Rticles
LaTeX Journal Article Templates for R Markdown
Stars: ✭ 895 (+3480%)
Mutual labels:  journal
Mini Diary
📘 Simple and secure journal app
Stars: ✭ 769 (+2976%)
Mutual labels:  journal
Pl Compiler Resource
程序语言与编译技术相关资料(持续更新中)
Stars: ✭ 578 (+2212%)
Mutual labels:  journal

ejournald

Ejournald is an Erlang interface for systemd's journald. It provides advanced write and read support.

Installation

Ejournald consists of two parts: the first part is a NIF for the communication with journald, the second is an Erlang application using it.

First, you have to compile the sources in c_src/ using make. You will need the systemd development header for that. Next you can compile the erlang source in src/.

Installation using tetrapak

Execute "tetrapak build".

Installation using rebar

Execute "rebar compile".

Usage

Ejournald is intended to provide logging support for journald. Together with lager and the lager_journald_backend it allows to write structured logs with additional metainformation into systemd's journal. Logging directly with ejournald is also possible (via the NIF-API) but it is recommended to use lager. On top of that ejournald provides:

  • an Erlang I/O-server for stream-like logging (without lager)
  • a high-level API for retrieving logs (possibly by Erlang specific meta information)

The I/O-server is is not capable of reading the journal. It can be used as an IO device together with the erlang io library. Therefore commands like io:format() or io:write() can be used in a very convenient way to write stuff into the journal without using lager.

To test this setup via simply sending error messages from an erlang shell, do the following: Start ejournald:

application:ensure_all_started(ejournald).
{ok,[ejournald]}

Set the handler for the lager backend and start lager:

application:set_env(lager, handlers, [{lager_journald_backend, []}]).
lager:start().

Send an error message (which the backend sends to the journal)

lager:error("Some error happened!").

Then simply check your journal for the corresponding message (e.g. 'journalctl -f'):

# journalctl
...
Jan 16 13:16:18 Host beam.smp[7481]: Some error happened!

It is possible to augment the logs with additional meta information (keys are always atoms)

lager:info([{current_weather, "Sunny"}, {temperature, 23}], "Hello World!", []).

Via 'journalctl -f -o verbose' you should see all log fields including the special ones set by you (not all fields are shown):

...
PRIORITY=6
_TRANSPORT=journal
ERL_APPLICATION=my_test_app
ERL_MODULE=my_test_app_mod
ERL_FUNCTION=start
ERL_LINE=20
ERL_PID="<0.36.0>"
[email protected]
MESSAGE=Hello World!
CURRENT_WEATHER="Sunny"
TEMPERATURE=23
...

Erlang specific fields which are set automatically by the backend are prepended with "ERL_".

Note that lager uses parse transform, e.g. you have to add

-compile([{parse_transform, lager_transform}]).

to your erlang module to compile it. If you want to test your stuff without doing that just use something like

lager:log(info, [{meta1, data1}, {meta2, data2}], "Hello World!").

See edocs for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].