Skip to content

Commit 88c64bd

Browse files
committed
Remove legacy PosWriter
The PosWriter class was needed when we needed to handle pos files manualy. And then to migrate to a storage. We can now remove this additional class.
1 parent 8a26010 commit 88c64bd

File tree

4 files changed

+27
-300
lines changed

4 files changed

+27
-300
lines changed

lib/fluent/plugin/in_systemd.rb

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
require 'systemd/journal'
44
require 'fluent/plugin/input'
5-
require 'fluent/plugin/systemd/pos_writer'
65
require 'fluent/plugin/systemd/entry_mutator'
76

87
module Fluent
98
module Plugin
109
# Fluentd plugin for reading from the systemd journal
11-
class SystemdInput < Input # rubocop:disable Metrics/ClassLength
10+
class SystemdInput < Input
1211
Fluent::Plugin.register_input('systemd', self)
1312

1413
helpers :timer, :storage
@@ -17,7 +16,6 @@ class SystemdInput < Input # rubocop:disable Metrics/ClassLength
1716

1817
config_param :path, :string, default: '/var/log/journal'
1918
config_param :filters, :array, default: []
20-
config_param :pos_file, :string, default: nil, deprecated: "Use <storage> section with `persistent: true' instead"
2119
config_param :read_from_head, :bool, default: false
2220
config_param :strip_underscores, :bool, default: false, deprecated: 'Use <entry> section or `systemd_entry` ' \
2321
'filter plugin instead'
@@ -39,7 +37,7 @@ class SystemdInput < Input # rubocop:disable Metrics/ClassLength
3937
def configure(conf)
4038
super
4139
@journal = nil
42-
@pos_storage = PosWriter.new(@pos_file, storage_create(usage: 'positions'))
40+
@pos_storage = storage_create(usage: 'positions')
4341
# legacy strip_underscores backwards compatibility (legacy takes
4442
# precedence and is mutually exclusive with the entry block)
4543
mut_opts = @strip_underscores ? { fields_strip_underscores: true } : @entry_opts.to_h
@@ -49,15 +47,9 @@ def configure(conf)
4947

5048
def start
5149
super
52-
@pos_storage.start
5350
timer_execute(:in_systemd_emit_worker, 1, &method(:run))
5451
end
5552

56-
def shutdown
57-
@pos_storage.shutdown
58-
super
59-
end
60-
6153
private
6254

6355
def init_journal
@@ -80,7 +72,7 @@ def seek
8072
seek_to(cursor || read_from)
8173
rescue Systemd::JournalError
8274
log.warn(
83-
"Could not seek to cursor #{cursor} found in pos file: #{@pos_storage.path}, " \
75+
"Could not seek to cursor #{cursor} found in position file: #{@pos_storage.path}, " \
8476
"falling back to reading from #{read_from}"
8577
)
8678
seek_to(read_from)

lib/fluent/plugin/systemd/pos_writer.rb

Lines changed: 0 additions & 99 deletions
This file was deleted.

test/plugin/systemd/test_pos_writer.rb

Lines changed: 0 additions & 157 deletions
This file was deleted.

0 commit comments

Comments
 (0)