now that varnish-rb is on rubygems we dont need to include the 4rd party code anymore.

This commit is contained in:
Louis Zuckerman 2013-03-30 23:34:20 -04:00
parent 3641c3a04b
commit 30c1870720
9 changed files with 2 additions and 163 deletions

View file

@ -9,7 +9,7 @@ class LogStash::Inputs::Varnishlog < LogStash::Inputs::Threadable
public
def register
require 'logstash/inputs/varnishlog/varnish'
require 'varnish'
@source = "varnishlog://#{Socket.gethostname}/"
@vd = Varnish::VSM.VSM_New
Varnish::VSL.VSL_Setup(@vd)

View file

@ -1,31 +0,0 @@
I copied the code under this directory from https://github.com/andreacampi/varnish-rb
I have only modified the 'require' statements to use paths within the logstash source.
It is distributed under the license below.
-Louis Zuckerman (semiosis)
March 29 2013, #monitorama hackathon
###########################
Copyright (c) 2011 ZephirWorks
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -1,6 +0,0 @@
module Varnish
LIBVARNISHAPI = 'libvarnishapi.1'
end
require 'logstash/inputs/varnishlog/varnish/vsm'
require 'logstash/inputs/varnishlog/varnish/vsl'

View file

@ -1,2 +0,0 @@
require 'logstash/inputs/varnishlog/varnish/utils/buffer_set'
require 'logstash/inputs/varnishlog/varnishutils/timer'

View file

@ -1,20 +0,0 @@
module Varnish
module Utils
module Timer
def timer_init
@count = 0
@time = 0
@interval = 40000
end
def timer_count
@time = Time.now if @count == 0
@count += 1
if (@count % @interval) == 0
puts "Got #{@count} calls in #{(Time.now - @time).to_f}s"
@time = Time.now
end
end
end
end
end

View file

@ -1,17 +0,0 @@
require 'logstash/inputs/varnishlog/varnish'
require 'ffi'
require 'logstash/inputs/varnishlog/varnish/vsl/enum'
module Varnish
module VSL
extend FFI::Library
ffi_lib Varnish::LIBVARNISHAPI
include Enum
callback :VSL_handler_f, [:pointer, VslTag, :int, :int, :int, :pointer, :int64], :int
attach_function 'VSL_Setup', [ :pointer ], :void
attach_function 'VSL_Open', [ :pointer, :int ], :int
attach_function 'VSL_Dispatch', [ :pointer, :VSL_handler_f, :pointer ], :int
end
end

View file

@ -1,75 +0,0 @@
require 'logstash/inputs/varnishlog/varnish'
require 'ffi'
module Varnish
module VSL
module Enum
extend FFI::Library
VslTag = enum(
:debug,
:error,
:cli,
:statsess,
:reqend,
:sessionopen,
:sessionclose,
:backendopen,
:backendxid,
:backendreuse,
:backendclose,
:httpgarbage,
:backend,
:length,
:fetcherror,
:rxrequest,
:rxresponse,
:rxstatus,
:rxurl,
:rxprotocol,
:rxheader,
:txrequest,
:txresponse,
:txstatus,
:txurl,
:txprotocol,
:txheader,
:objrequest,
:objresponse,
:objstatus,
:objurl,
:objprotocol,
:objheader,
:lostheader,
:ttl,
:fetch_body,
:vcl_acl,
:vcl_call,
:vcl_trace,
:vcl_return,
:vcl_error,
:reqstart,
:hit,
:hitpass,
:expban,
:expkill,
:workthread,
:esi_xmlerror,
:hash,
:backend_health,
:vcl_log,
:gzip
)
end
end
end

View file

@ -1,11 +0,0 @@
require 'logstash/inputs/varnishlog/varnish'
require 'ffi'
module Varnish
module VSM
extend FFI::Library
ffi_lib Varnish::LIBVARNISHAPI
attach_function 'VSM_New', [], :pointer
end
end

View file

@ -66,6 +66,7 @@ Gem::Specification.new do |gem|
gem.add_runtime_dependency "rufus-scheduler" #(MIT license)
gem.add_runtime_dependency "user_agent_parser", [">= 2.0.0"] #(MIT license)
gem.add_runtime_dependency "snmp" #(ruby license)
gem.add_runtime_dependency "varnish-rb" #(MIT license)
if RUBY_PLATFORM == 'java'
gem.platform = RUBY_PLATFORM