mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
- Support ruby 1.9
This commit is contained in:
parent
7b83c35eaf
commit
46c4feb300
4 changed files with 15 additions and 4 deletions
|
@ -21,18 +21,19 @@ class Agent < LogStash::Net::MessageClient
|
|||
end # def initialize
|
||||
|
||||
def start_log_watcher
|
||||
Thread.new do
|
||||
@t1 = Thread.new do
|
||||
File::Tail::Since.new("/var/log/messages").tail do |line|
|
||||
line.chomp!
|
||||
index("linux-syslog", line)
|
||||
end
|
||||
end
|
||||
|
||||
Thread.new do
|
||||
@t2 = Thread.new do
|
||||
File::Tail::Since.new("/b/access").tail do |line|
|
||||
line.chomp!
|
||||
index("httpd-access", line)
|
||||
end
|
||||
exit
|
||||
end
|
||||
end # def start_log_watcher
|
||||
|
||||
|
|
|
@ -25,3 +25,11 @@ class String
|
|||
|
||||
alias_method :checksum, :adler32
|
||||
end # class String
|
||||
|
||||
# EventMachine uses ruby1.8 (not in 1.9) function Thread#kill!,
|
||||
# so let's fake it.
|
||||
class Thread
|
||||
def kill!(*args)
|
||||
kill
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,7 +30,9 @@ module BindToHash
|
|||
if value.is_a?(String)
|
||||
(0 .. value.length - 1).each do |i|
|
||||
break if !value[i]
|
||||
if value[i] >= 128
|
||||
# ruby 1.9 String#[] returns a string, 1.8 returns an int
|
||||
# force an int.
|
||||
if value[i].to_i >= 128
|
||||
value[i] = ""
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,7 +32,7 @@ module LogStash; module Net
|
|||
|
||||
name = msg.class.name.split(":")[-1]
|
||||
func = "#{name}Handler"
|
||||
if @handler.respond_to?(func):
|
||||
if @handler.respond_to?(func)
|
||||
#operation = lambda do
|
||||
#@handler.send(func, msg) do |response|
|
||||
#sendmsg(response)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue