logstash-filter-geoip 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/logstash/filters/geoip.rb +2 -2
- data/logstash-filter-geoip.gemspec +1 -1
- data/spec/filters/geoip_spec.rb +52 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cb9d672a670ac659f61fa7604bc57274eabd759
|
4
|
+
data.tar.gz: d697817443b57ce1ef55e4dbdd19caf657e90cc6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95c606eb5c2df267eb7476b91247bf14e9c4758ea1c27b720342fc6d624091473b754c11cf1b42ed13204e321910e288f17bc95e90e61fe4abd3a2e73083c213
|
7
|
+
data.tar.gz: 62ba7bd2e0a890969d6e2ca3c1a0575ab1ccdd8e84232d468bee03bcab0294e4d9850d889160ec5973093313cd6263ab4554897d47fe8c15400b2208bfdc886b
|
data/README.md
CHANGED
@@ -109,9 +109,9 @@ class LogStash::Filters::GeoIP < LogStash::Filters::Base
|
|
109
109
|
ip = ip.first if ip.is_a? Array
|
110
110
|
geo_data = Thread.current[@threadkey].send(@geoip_type, ip)
|
111
111
|
rescue SocketError => e
|
112
|
-
@logger.error("IP Field contained invalid IP address or hostname", :field => @
|
112
|
+
@logger.error("IP Field contained invalid IP address or hostname", :field => @source, :event => event)
|
113
113
|
rescue Exception => e
|
114
|
-
@logger.error("Unknown error while looking up GeoIP data", :exception => e, :field => @
|
114
|
+
@logger.error("Unknown error while looking up GeoIP data", :exception => e, :field => @source, :event => event)
|
115
115
|
end
|
116
116
|
|
117
117
|
return if geo_data.nil? || !geo_data.respond_to?(:to_hash)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-filter-geoip'
|
4
|
-
s.version = '1.0.
|
4
|
+
s.version = '1.0.2'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "$summary"
|
7
7
|
s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
|
data/spec/filters/geoip_spec.rb
CHANGED
@@ -171,4 +171,56 @@ describe LogStash::Filters::GeoIP do
|
|
171
171
|
it_behaves_like "an event with a [geoip][location] field"
|
172
172
|
end
|
173
173
|
end
|
174
|
+
|
175
|
+
describe "an invalid IP" do
|
176
|
+
config <<-CONFIG
|
177
|
+
filter {
|
178
|
+
geoip {
|
179
|
+
source => "ip"
|
180
|
+
database => "#{ASNDB}"
|
181
|
+
}
|
182
|
+
}
|
183
|
+
CONFIG
|
184
|
+
|
185
|
+
context "should not raise an error" do
|
186
|
+
sample("ip" => "-") do
|
187
|
+
expect{
|
188
|
+
subject
|
189
|
+
}.to_not raise_error
|
190
|
+
end
|
191
|
+
|
192
|
+
sample("ip" => "~") do
|
193
|
+
expect{
|
194
|
+
subject
|
195
|
+
}.to_not raise_error
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
context "should return the correct source field in the logging message" do
|
200
|
+
sample("ip" => "-") do
|
201
|
+
expect(LogStash::Filters::GeoIP.logger).to receive(:error).with(anything, include(:field => "ip"))
|
202
|
+
subject
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
end
|
207
|
+
|
208
|
+
describe "an invalid database" do
|
209
|
+
config <<-CONFIG
|
210
|
+
filter {
|
211
|
+
geoip {
|
212
|
+
source => "ip"
|
213
|
+
database => "./Gemfile"
|
214
|
+
}
|
215
|
+
}
|
216
|
+
CONFIG
|
217
|
+
|
218
|
+
context "should return the correct sourcefield in the logging message" do
|
219
|
+
sample("ip" => "8.8.8.8") do
|
220
|
+
expect(LogStash::Filters::GeoIP.logger).to receive(:error).with(anything, include(:field => "ip"))
|
221
|
+
subject
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
end
|
174
226
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-geoip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstash-core
|