logstash-filter-wkt_repair 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logstash/filters/wkt_repair.rb +9 -6
- data/logstash-filter-wkt_repair.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0703f126a6eac67876b49932f9bd33cfc0e4cd1f19fcf4f455565d467aac2b8f
|
4
|
+
data.tar.gz: 5d54a6509578faa5b9a0f15d2c479f0dbde28d381a1f5a74c081ae28b94c90a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b92d90d643ae0f2a93a65be169615e41866f18944a86ae7361c8e3ad6e75033e1beb46deb51262dc65e3d06f8c47fdccedb25dc01fb5add50f113db2abbf2c72
|
7
|
+
data.tar.gz: 75209dbe1c75c40740a4aebe5c188c3df8eb875ceb9fc72603d69b926cc5b9a1028520639f898ca2ca83b7c57148204dbc5b0a856ba1bedd52c1311c743a7ca9
|
@@ -2,6 +2,7 @@
|
|
2
2
|
require "logstash/filters/base"
|
3
3
|
require "logstash/namespace"
|
4
4
|
require "open3"
|
5
|
+
require 'securerandom'
|
5
6
|
|
6
7
|
class LogStash::Filters::WktRepair < LogStash::Filters::Base
|
7
8
|
|
@@ -28,18 +29,20 @@ class LogStash::Filters::WktRepair < LogStash::Filters::Base
|
|
28
29
|
def filter(event)
|
29
30
|
|
30
31
|
wkt = event.get(@source)
|
31
|
-
|
32
|
+
event_uuid = SecureRandom.uuid
|
33
|
+
temp_file = "temp-wkt_#{event_uuid}.txt"
|
32
34
|
|
33
35
|
begin
|
34
|
-
|
36
|
+
IO.write(temp_file, wkt)
|
35
37
|
|
36
38
|
wkt_repair_cmd = "prepair -f #{temp_file}"
|
37
|
-
|
39
|
+
stdout, stderr, status = Open3.capture3("#{wkt_repair_cmd}")
|
38
40
|
|
39
41
|
if status.success?
|
40
|
-
event.set(@target,
|
42
|
+
event.set(@target, stdout.strip)
|
41
43
|
else
|
42
|
-
@logger.error("WKT Repair Error: #{
|
44
|
+
@logger.error("WKT Repair Error: #{stderr}")
|
45
|
+
@logger.error("WKT Repair Output Message: #{stdout}")
|
43
46
|
@tag_on_failure.each { |tag| event.tag(tag) }
|
44
47
|
end
|
45
48
|
rescue Exception => e
|
@@ -47,7 +50,7 @@ class LogStash::Filters::WktRepair < LogStash::Filters::Base
|
|
47
50
|
@tag_on_failure.each { |tag| event.tag(tag) }
|
48
51
|
ensure
|
49
52
|
if File.file?(temp_file)
|
50
|
-
File.
|
53
|
+
File.delete(temp_file)
|
51
54
|
end
|
52
55
|
end
|
53
56
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-filter-wkt_repair'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.9'
|
4
4
|
s.licenses = ['Apache-2.0']
|
5
5
|
s.summary = 'Logstash filter to repair a WKT shape data.'
|
6
6
|
s.description = 'It takes ambigous or ill-defined polygons and returns a coherent and clearly defined output.'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-wkt_repair
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Silver Ibenye
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|