logstash-lite 0.2.20110203130400 → 0.2.20110206003603
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/logstash/event.rb +10 -0
- data/lib/logstash/outputs/elasticsearch.rb +10 -9
- metadata +4 -4
data/lib/logstash/event.rb
CHANGED
@@ -141,4 +141,14 @@ class LogStash::Event
|
|
141
141
|
#$stderr.puts "sprintf(#{format.inspect}) => #{result.inspect}"
|
142
142
|
return result
|
143
143
|
end # def sprintf
|
144
|
+
|
145
|
+
public
|
146
|
+
def ==(other)
|
147
|
+
puts "#{self.class.name}#==(#{other.inspect})"
|
148
|
+
if !other.is_a?(self.class)
|
149
|
+
return false
|
150
|
+
end
|
151
|
+
|
152
|
+
return other.to_hash == self.to_hash
|
153
|
+
end # def ==
|
144
154
|
end # class LogStash::Event
|
@@ -94,17 +94,18 @@ class LogStash::Outputs::Elasticsearch < LogStash::Outputs::Base
|
|
94
94
|
else raise "unknown elasticsearch method #{params["method"].inspect}"
|
95
95
|
end
|
96
96
|
|
97
|
-
receive(LogStash::Event.new({
|
98
|
-
"@source" => "@logstashinit",
|
99
|
-
"@type" => "@none",
|
100
|
-
"@message" => "Starting logstash output to elasticsearch",
|
101
|
-
"@fields" => {
|
102
|
-
"HOSTNAME" => Socket.gethostname
|
103
|
-
},
|
104
|
-
}))
|
97
|
+
#receive(LogStash::Event.new({
|
98
|
+
#"@source" => "@logstashinit",
|
99
|
+
#"@type" => "@none",
|
100
|
+
#"@message" => "Starting logstash output to elasticsearch",
|
101
|
+
#"@fields" => {
|
102
|
+
#"HOSTNAME" => Socket.gethostname
|
103
|
+
#},
|
104
|
+
#}))
|
105
105
|
|
106
106
|
pending = @pending
|
107
107
|
@pending = []
|
108
|
+
@logger.info("Flushing #{pending.size} events")
|
108
109
|
pending.each do |event|
|
109
110
|
receive(event)
|
110
111
|
end
|
@@ -123,7 +124,7 @@ class LogStash::Outputs::Elasticsearch < LogStash::Outputs::Base
|
|
123
124
|
def receive_http(event, tries=5)
|
124
125
|
req = @http.post :body => event.to_json
|
125
126
|
req.errback do
|
126
|
-
|
127
|
+
@logger.warn("Request to index to #{@url.to_s} failed (will retry, #{tries} tries left). Event was #{event.to_s}")
|
127
128
|
EventMachine::add_timer(2) do
|
128
129
|
# TODO(sissel): Actually abort if we retry too many times.
|
129
130
|
receive_http(event, tries - 1)
|
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:
|
4
|
+
hash: 40220412007217
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 20110206003603
|
10
|
+
version: 0.2.20110206003603
|
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-02-
|
19
|
+
date: 2011-02-06 00:00:00 -08:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|