Class: LogStash::Inputs::Varnishlog

Inherits:
Threadable show all
Defined in:
lib/logstash/inputs/varnishlog.rb

Overview

Read from varnish cache’s shared memory log

Constant Summary

Constants included from Config::Mixin

Config::Mixin::CONFIGSORT

Instance Attribute Summary

Attributes inherited from Base

#params, #threadable

Attributes included from Config::Mixin

#config, #original_params

Attributes inherited from Plugin

#logger, #params

Instance Method Summary collapse

Methods inherited from Threadable

#initialize

Methods inherited from Base

#initialize, #tag

Methods included from Config::Mixin

#config_init, included

Methods inherited from Plugin

#eql?, #finished, #finished?, #hash, #initialize, #inspect, lookup, #reload, #running?, #shutdown, #terminating?, #to_s

Constructor Details

This class inherits a constructor from LogStash::Inputs::Threadable

Instance Method Details

#registerObject



12
13
14
15
16
17
18
# File 'lib/logstash/inputs/varnishlog.rb', line 12

def register
  require 'varnish'
  @vd = Varnish::VSM.VSM_New
  Varnish::VSL.VSL_Setup(@vd)
  Varnish::VSL.VSL_Open(@vd, 1)

end

#run(queue) ⇒ Object

def register



20
21
22
23
24
# File 'lib/logstash/inputs/varnishlog.rb', line 20

def run(queue)
  @q = queue
  @hostname = Socket.gethostname
  Varnish::VSL.VSL_Dispatch(@vd, self.method(:cb).to_proc, FFI::MemoryPointer.new(:pointer))
end

#teardownObject



45
46
47
# File 'lib/logstash/inputs/varnishlog.rb', line 45

def teardown
  finished
end