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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc9c5d7ca4a8916526fc1a03e4e2d2ba34da1679c0f00db248bc62dea2171e3a
4
- data.tar.gz: 193c6f9be30632103985030bc45fa2e3fc1c71b0722e0b9bbe72ce0c7efe1ee8
3
+ metadata.gz: 0703f126a6eac67876b49932f9bd33cfc0e4cd1f19fcf4f455565d467aac2b8f
4
+ data.tar.gz: 5d54a6509578faa5b9a0f15d2c479f0dbde28d381a1f5a74c081ae28b94c90a9
5
5
  SHA512:
6
- metadata.gz: 0ed596b17b402e5d55dfd5e1ad5200f0316ef557d78a09a10e79255c351162cbbf9429769dd5d1fe1dd45d42819b928aefb22a5a90f13916ed51e912a39df614
7
- data.tar.gz: 4b6f2ce9ff8e4a262e77f178e1ef64e6176aa7b3ab8dbd199339efd171739974e36d4ac2c57d50cb344c08d3f82a324cf470f21d7af3f01f8f77e1c80a03546e
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
- temp_file = "temp-wkt.txt"
32
+ event_uuid = SecureRandom.uuid
33
+ temp_file = "temp-wkt_#{event_uuid}.txt"
32
34
 
33
35
  begin
34
- File.open(temp_file, "w+") {|f| f.write("#{wkt}") }
36
+ IO.write(temp_file, wkt)
35
37
 
36
38
  wkt_repair_cmd = "prepair -f #{temp_file}"
37
- std_out, std_err, status = Open3.capture3("#{wkt_repair_cmd}")
39
+ stdout, stderr, status = Open3.capture3("#{wkt_repair_cmd}")
38
40
 
39
41
  if status.success?
40
- event.set(@target, std_out.strip)
42
+ event.set(@target, stdout.strip)
41
43
  else
42
- @logger.error("WKT Repair Error: #{std_err}")
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.open(temp_file, "r+") {|f| f.truncate(0) }
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.8'
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.8
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-04 00:00:00.000000000 Z
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