Open b-a-t opened 1 year ago
So, the change is really small. Without much of the understanding, just mostly cut-n-paste:
--- in_systemd.rb.orig 2023-11-03 17:37:20.875477097 +0000
+++ in_systemd.rb 2023-11-04 00:17:33.088467944 +0000
@@ -50,7 +50,8 @@ module Fluent
def configure(conf)
super
@journal = nil
- @pos_storage = storage_create(usage: 'positions')
+ config = conf.elements.find{|e| e.name == 'storage' }
+ @pos_storage = storage_create(usage: 'positions', conf: config, default_type: DEFAULT_STORAGE_TYPE)
@mutator = SystemdEntryMutator.new(**@entry_opts.to_h)
@mutator.warnings.each { |warning| log.warn(warning) }
end
If that seems legitimate, I can make an MR, although that diff is trivial to apply by hand as well.
I'm new to the
fluentd
so it could be that I'm missing something. Trying to configure it to send all the busyjournald
logs to the OpenSearch I've tried to configure it with multiple workers, so I could perform several parallel processes. Apparentlyfluent-plugin-systemd
still doesn't support multi-worker setup, so I've tried to assign input to one fixed worker.That seems to work, but the need to specify storage
path
looked overwhelming(I wanted to keep all work files in the more appropriate/var/lib/fluent
dir rather than/var/log/fluent
). Especially, as the documentation refers to the storage plugin without any limitations.So, the configuration I tried first was:
That worked, producing a position file
/var/lib/fluent/systemd-cursor/worker0/storage.json
. So far so good. But the need to specify/var/lib/fluent
seems to be excessive.So, my next(2) try was:
That also worked, producing
/var/lib/fluent/worker0/systemd/storage.json
. That already brings questions, as the name of the cursor file got hard coded to thestorage.json
, as well as in the first variant, but there you at least get a customsystemd-cursor
in the path which may make the difference in case there are two or more inputs with@type systemd
(pretty common setup for K8s, apparently).Also, log got:
which explains the result above.
Ok, how about(3) the
conf.arg
from the documentation?That simply doesn't work, failing with the:
At this point, I thought that I was doing something wrong, and I re-read the documentation several times as well as tried to understand the Ruby source code(not in my portfolio).
In a few other plugins, I found the way how (local) storage is configured and modified the code accordingly.
Amusingly that helped and I got the desired
/var/lib/fluent/worker0/systemd/storage.systemd_cursor.json
!Without
conf.arg
it gives the expected/var/lib/fluent/worker0/systemd/storage.json
.Configuration (2) also works the same way with the message about redundant
@id
(I was hoping it'll actually pick the parameter).I haven't tried though how all those permutations would work without the multiple workers.