Class: Fluent::SystemdInput

Inherits:
Input
  • Object
show all
Defined in:
lib/fluent/plugin/in_systemd.rb,
lib/fluent/plugin/systemd/pos_writer.rb

Defined Under Namespace

Classes: PosWriter

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#tagObject (readonly)

Returns the value of attribute tag.



14
15
16
# File 'lib/fluent/plugin/in_systemd.rb', line 14

def tag
  @tag
end

Instance Method Details

#configure(conf) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/fluent/plugin/in_systemd.rb', line 16

def configure(conf)
  super
  @pos_writer = PosWriter.new(conf['pos_file'])
  @journal = Systemd::Journal.new(path: path)
  journal.filter(*filters)
  read_from = @pos_writer.cursor || (conf['read_from_head'] ? :head : :tail)
  journal.seek(read_from)
end

#shutdownObject



32
33
34
35
36
# File 'lib/fluent/plugin/in_systemd.rb', line 32

def shutdown
  @running = false
  @thread.join
  pos_writer.shutdown
end

#startObject



25
26
27
28
29
30
# File 'lib/fluent/plugin/in_systemd.rb', line 25

def start
  super
  @running = true
  pos_writer.start
  @thread = Thread.new(&method(:run))
end