fluent-plugins-nursery / fluent-plugin-systemd

This is a fluentd input plugin. It reads logs from the systemd journal.
Apache License 2.0
153 stars 43 forks source link

Fix test for libsystemd v250 #101

Closed daipom closed 11 months ago

daipom commented 1 year ago

This will fix the failing test in following RP.

The latest libsystemd can read some corrupted entries without errors.

Since libsystemd v250, it's specification against journal file corruption changed.

https://github.com/systemd/systemd/blob/v250/NEWS#L807-L808

In AlmaLinux9 (libsystemd v250):

require "systemd"
require "systemd/journal"
journal = Systemd::Journal.new(path: "test/fixture/corrupt")
entries = journal.to_a # Succeeds without errors
entries[2] # Before v250, it couldn't read this entry.
=> #<Systemd::JournalEntry:0x000000000003ba60 priority: '6',
_boot_id: '4737ffc504774b3ba67020bc947f1bc0', _machine_id:
'bb9d0a52a41243829ecd729b40ac0bce', _hostname: 'arch',
_source_monotonic_timestamp: '0', _transport: 'kernel',
syslog_identifier: 'kernel'>

Assuming both old and new libsystemd, it would be good to fix the test in this way.