OpenLMI Journald is a CIM provider which manages systemd journald log records and basic means of iteration and log writing. It exposes remotely accessible object-oriented API using WBEM set of protocols and technologies.
Journald is a daemon working with journals. Journal is a log, a set of log records, chronologically ordered. Records are structured, able to carry multiple (custom) data fields. By implementation, journald is able to work with multiple (separate) journals but we use the mixed way for the moment, which is typical in production use.
Classes used by the provider were chosen to mimic the sblim-cmpi-syslog provider set of classes allowing drop-in replacement in production tools. We haven’t been able to find a profile it conforms to though. There’s a related DMTF profile DSP1010 “Record Log Profile” which may be subject to extension of this provider in the future. As a benefit, by using the parent classes (e.g. CIM_LogRecord), one is able to mix log records from orthodox syslog and journald together.
For the moment, global journal is used, all journal files are mixed together.
The API can be accessed by any WBEM-capable client. OpenLMI already provides:
- Python module lmi.scripts.journald, part of OpenLMI scripts.
- Command line tool: LMI metacommand, with ‘journald’ subcommand.
- Log records reading.
- Log record iteration using persistent iterators.
- New records indication.
- Writing new log records.
Following LMIShell example prints last 1000 entries in the system log:
c = connect("localhost", "pegasus", "mypassword") for rec in c.root.cimv2.LMI_JournalMessageLog.first_instance().associators(): print "%s %s %s" % (rec.MessageTimestamp.datetime.ctime(), rec.HostName, rec.DataFormat)
More examples can be found in the Usage chapter.
Table of Contents