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

Hard dependency on libsystemd for filter_systemd_entry #73

Closed stevenjm closed 5 years ago

stevenjm commented 5 years ago

Hi there,

I'm looking at using the filter_systemd_entry plugin independently of the in_systemd plugin, running in Docker. Currently, this requires pulling the Debian-based fluentd Docker image because the fluent-plugin-systemd gem has a hard dependency on systemd-journal which requires libsystemd, even though filter_systemd_entry doesn't use it.

The Alpine-based image is significantly smaller and works fine if I download and install the gem's files manually, as long as I don't use in_systemd, which does require libsystemd.

To expand on the use case for this, we use Fluent Bit to collect logs from the journal on all hosts, and forward those to fluentd aggregators running in Docker. It makes the most sense to centralise the filtering of these logs on the aggregators, and we'd like to use filter_systemd_entry for that.

I can see two possible solutions:

  1. Split filter_systemd_entry into its own gem with no dependency on systemd-journal.
  2. Remove the systemd-journal dependency from the existing gemspec, and document that it must be installed in order to use in_systemd. (This would likely complicate the most common use case, but it should work.)

Please let me know if there is anything I can do to help fix this.

Thanks, Steven

errm commented 5 years ago

I guess option 1 seems best ... then this gem can depend on that ... I will add it to my list of things to do...

I think option 2 sounds crummy I don't want to have to make the plugin any more complex to install for the basic usecase...

errm commented 5 years ago

I just had a look at installing systemd-journal on alpine and there doesn't seem to be any build-time dependency on libsystemd... This makes sense since it uses ffi ...

apk add --no-cache build-base ruby-dev && gem install systemd-journal --no-doc

This works fine for me ... I guess it would be nice to have a version without any native extensions but for now I think this is really low priority for me to work on ... 🤷‍♂️ PR welcome though :)

stevenjm commented 5 years ago

Thanks for the reply!

This works fine for me

It looks like this must have been me failing at reading error messages. Now I have egg on my face. :slightly_frowning_face: I'll close this since it does actually work.