logstash-lite 0.2.20110112115019 → 0.2.20110122143801

Sign up to get free protection for your applications and to get access to all the features.
data/etc/foo.yaml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ inputs:
3
+ all:
4
+ - syslog://0.0.0.0:5544/
5
+ outputs:
6
+ - stdout:///
@@ -80,7 +80,7 @@ class LogStash::Filters::Grep < LogStash::Filters::Base
80
80
  if event[field].empty? and match["negate"] == true
81
81
  match_count += 1
82
82
  end
83
- event[field].each do |value|
83
+ (event[field].is_a?(Array) ? event[field] : [event[field]]).each do |value|
84
84
  if match["negate"] == true
85
85
  @logger.debug("want negate match")
86
86
  next if re.match(value)
@@ -27,7 +27,13 @@ class LogStash::Inputs::Amqp < LogStash::Inputs::Base
27
27
  public
28
28
  def register
29
29
  @logger.info("Registering input #{@url}")
30
- @amqp = AMQP.connect(:host => @url.host)
30
+ amqpsettings = {
31
+ :host => @url.host,
32
+ :port => (@url.port or 5672),
33
+ }
34
+ amqpsettings[:user] = @url.user if @url.user
35
+ amqpsettings[:pass] = @url.password if @url.password
36
+ @amqp = AMQP.connect(amqpsettings)
31
37
  @mq = MQ.new(@amqp)
32
38
  @target = nil
33
39
 
@@ -24,7 +24,13 @@ class LogStash::Outputs::Amqp < LogStash::Outputs::Base
24
24
  public
25
25
  def register
26
26
  @logger.info("Registering output #{@url}")
27
- @amqp = AMQP.connect(:host => @url.host, :port => (@url.port or 5672))
27
+ amqpsettings = {
28
+ :host => @url.host,
29
+ :port => (@url.port or 5672),
30
+ }
31
+ amqpsettings[:user] = @url.user if @url.user
32
+ amqpsettings[:pass] = @url.password if @url.password
33
+ @amqp = AMQP.connect(amqpsettings)
28
34
  @mq = MQ.new(@amqp)
29
35
  @target = nil
30
36
 
@@ -62,7 +62,8 @@ class LogStash::Outputs::Elasticsearch < LogStash::Outputs::Base
62
62
  @callback = self.method(:receive_http)
63
63
  when "river"
64
64
  params["port"] ||= 5672
65
- mq_url = URI::parse("amqp://#{params["host"]}:#{params["port"]}/queue/#{params["queue"]}?durable=1")
65
+ auth = "#{params["user"] or "guest"}:#{params["pass"] or "guest"}"
66
+ mq_url = URI::parse("amqp://#{auth}@#{params["host"]}:#{params["port"]}/queue/#{params["queue"]}?durable=1")
66
67
  @mq = LogStash::Outputs::Amqp.new(mq_url.to_s)
67
68
  @mq.register
68
69
  @callback = self.method(:receive_river)
@@ -8,3 +8,5 @@ if !String.instance_methods.include?("start_with?")
8
8
  end
9
9
  end
10
10
  end
11
+
12
+ require "logstash/rubyfixes/regexp_union_takes_array"
@@ -0,0 +1,27 @@
1
+ # Check if Regexp.union takes an array. If not, monkeypatch it.
2
+ # This feature was added in Ruby 1.8.7 and is required by
3
+ # Rack 1.2.1, breaking ruby <= 1.8.6
4
+
5
+ needs_fix = false
6
+ begin
7
+ Regexp.union(["a", "b"])
8
+ rescue TypeError => e
9
+ if e.message == "can't convert Array into String"
10
+ needs_fix = true
11
+ end
12
+ end
13
+
14
+ if needs_fix
15
+ class Regexp
16
+ class << self
17
+ alias_method :orig_regexp_union, :union
18
+ public
19
+ def union(*args)
20
+ if args[0].is_a?(Array) && args.size == 1
21
+ return orig_regexp_union(*args[0])
22
+ end
23
+ return orig_regexp_union(*args)
24
+ end # def union
25
+ end # class << self
26
+ end # class Regexp
27
+ end # if needs_fix
@@ -63,7 +63,8 @@ class LogStash::Web::Server < Sinatra::Base
63
63
  # have javascript enabled, we need to show the results in
64
64
  # case a user doesn't have javascript.
65
65
  if params[:q] and params[:q] != ""
66
- elasticsearch.search(params) do |@results|
66
+ elasticsearch.search(params) do |results|
67
+ @results = results
67
68
  @hits = (@results["hits"]["hits"] rescue [])
68
69
  begin
69
70
  result_callback.call
@@ -82,8 +83,8 @@ class LogStash::Web::Server < Sinatra::Base
82
83
  headers({"Content-Type" => "text/html" })
83
84
  count = params["count"] = (params["count"] or 50).to_i
84
85
  offset = params["offset"] = (params["offset"] or 0).to_i
85
- elasticsearch.search(params) do |@results|
86
- #p instance_variables
86
+ elasticsearch.search(params) do |results|
87
+ @results = results
87
88
  if @results.include?("error")
88
89
  body haml :"search/error", :layout => !request.xhr?
89
90
  next
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-lite
3
3
  version: !ruby/object:Gem::Version
4
- hash: 40220224230017
5
- prerelease: false
4
+ hash: 40220244287589
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 20110112115019
10
- version: 0.2.20110112115019
9
+ - 20110122143801
10
+ version: 0.2.20110122143801
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jordan Sissel
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-01-12 00:00:00 -08:00
19
+ date: 2011-01-22 00:00:00 -08:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -115,6 +115,7 @@ files:
115
115
  - lib/logstash/outputs/beanstalk.rb
116
116
  - lib/logstash/outputs/tcp.rb
117
117
  - lib/logstash/namespace.rb
118
+ - lib/logstash/rubyfixes/regexp_union_takes_array.rb
118
119
  - lib/logstash/time.rb
119
120
  - lib/logstash/filters.rb
120
121
  - lib/logstash/outputs.rb
@@ -220,6 +221,7 @@ files:
220
221
  - examples/sample-agent-in-ruby.rb
221
222
  - etc/tograylog.yaml
222
223
  - etc/logstash-elasticsearch-rabbitmq-river.yaml
224
+ - etc/foo.yaml
223
225
  - etc/init/logstash
224
226
  - etc/logstash-nagios.yaml
225
227
  - etc/logstash-reader.yaml
@@ -277,7 +279,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
277
279
  requirements: []
278
280
 
279
281
  rubyforge_project:
280
- rubygems_version: 1.3.7
282
+ rubygems_version: 1.4.2
281
283
  signing_key:
282
284
  specification_version: 3
283
285
  summary: logstash - log and event management (lite install, no dependencies)