Class: Fusuma::Plugin::Inputs::AppmatcherInput

Inherits:
Input
  • Object
show all
Defined in:
lib/fusuma/plugin/inputs/appmatcher_input.rb

Overview

Get active application’s name

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pidObject (readonly)

Returns the value of attribute pid.



10
11
12
# File 'lib/fusuma/plugin/inputs/appmatcher_input.rb', line 10

def pid
  @pid
end

Instance Method Details

#create_event(record:) ⇒ Event

Parameters:

  • record (String)

    application name

Returns:

  • (Event)


33
34
35
36
37
38
39
40
# File 'lib/fusuma/plugin/inputs/appmatcher_input.rb', line 33

def create_event(record:)
  e = Events::Event.new(
    tag: tag,
    record: Events::Records::AppmatcherRecord.new(name: record)
  )
  MultiLogger.debug(input_event: e)
  e
end

#ioObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fusuma/plugin/inputs/appmatcher_input.rb', line 12

def io
  @backend ||= Appmatcher.backend_klass.new

  @pid ||= begin
    pid = @backend.watch_start
    # NOTE: Closing the parent process's pipe
    @backend.writer.close

    pid
  end

  @backend.reader
end

#shutdownObject



26
27
28
29
# File 'lib/fusuma/plugin/inputs/appmatcher_input.rb', line 26

def shutdown
  # CustomProcess#shutdown
  @backend.shutdown
end