logstash-output-picsv 1.0.5 → 1.0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/lib/logstash/outputs/picsv.rb +18 -17
- data/logstash-output-picsv.gemspec +18 -14
- data/spec/outputs/picsv_spec.rb +6 -4
- metadata +27 -15
- data/.gitignore +0 -2
- data/Rakefile +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea2d0b9ef166adb04ad2572ba4c19bca0ff4c84f
|
4
|
+
data.tar.gz: 1c62bdb5f4e5eabf4b7219ec67ad2e0389aa2b6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47c3a827a8136846799b4a4c08cc58deedc8dcc4b020b861da3aca456cceb0c194a1409829320d195c52e1c36f83ce90c8a0489928a8d3de7a8d7b1479f31367
|
7
|
+
data.tar.gz: 2e4e842ba559e6ba29264b8c036c58cb88d2532715f1ce24fa7bbbc86a2d8e7187b15d07917a40767f7889af01199e666b6eb12ea71035dfc7c50a9a2bcfe5d4
|
data/Gemfile
CHANGED
@@ -1,28 +1,29 @@
|
|
1
1
|
############################################
|
2
2
|
#
|
3
|
-
#
|
3
|
+
# PICSV
|
4
4
|
#
|
5
5
|
# Logstash mediation output for IOA PI
|
6
6
|
#
|
7
7
|
# Version 030815.1 Robert Mckeown
|
8
|
-
# Version 030815.
|
8
|
+
# Version 030815.9 Jim Ray
|
9
9
|
#
|
10
10
|
############################################
|
11
|
+
# encoding: utf-8
|
11
12
|
|
12
|
-
require "csv"
|
13
|
-
require "logstash/namespace"
|
14
13
|
require "logstash/outputs/file"
|
14
|
+
require "logstash/namespace"
|
15
|
+
require "csv"
|
15
16
|
require 'java' # for the java data format stuff
|
16
17
|
|
17
|
-
#
|
18
|
+
# PICSV - based upon original Logstash CSV output.
|
18
19
|
#
|
19
20
|
# Write events to disk in CSV format
|
20
21
|
# Write a PI header as the first line in the file
|
21
22
|
# Name file per PI convention, based upon first and last timestamps encountered
|
22
23
|
|
23
|
-
class LogStash::Outputs::
|
24
|
-
|
25
|
-
config_name "
|
24
|
+
class LogStash::Outputs::PICSV < LogStash::Outputs::File
|
25
|
+
|
26
|
+
config_name "picsv"
|
26
27
|
milestone 1
|
27
28
|
|
28
29
|
# The field names from the event that should be written to the CSV file.
|
@@ -105,15 +106,15 @@ class LogStash::Outputs::SCACSV < LogStash::Outputs::File
|
|
105
106
|
private
|
106
107
|
def flushWatchdog(delay)
|
107
108
|
begin
|
108
|
-
@logger.debug("
|
109
|
+
@logger.debug("PICSVFlushWatchdog - Last output time = " + @lastOutputTime.to_s)
|
109
110
|
while true do
|
110
|
-
@logger.debug("
|
111
|
+
@logger.debug("PICSVFlushWatchdog - Time.now = " + Time.now.to_s + " $lastOutputTime=" + @lastOutputTime.to_s + " delay=" + delay.to_s)
|
111
112
|
|
112
113
|
if ( (Time.now.to_i >= (@lastOutputTime.to_i + delay.to_i)) and (@recordCount > 0)) then
|
113
|
-
@logger.debug("
|
114
|
+
@logger.debug("PICSVFlushWatchdog - closeAndRenameCurrentFile")
|
114
115
|
closeAndRenameCurrentFile
|
115
116
|
end
|
116
|
-
@logger.debug("
|
117
|
+
@logger.debug("PICSVFlushWatchdog - Sleeping")
|
117
118
|
sleep 1
|
118
119
|
end
|
119
120
|
end
|
@@ -123,7 +124,7 @@ class LogStash::Outputs::SCACSV < LogStash::Outputs::File
|
|
123
124
|
def receive(event)
|
124
125
|
return unless output?(event)
|
125
126
|
|
126
|
-
@logger.debug("in
|
127
|
+
@logger.debug("in PICSV receive")
|
127
128
|
|
128
129
|
if (event['SCAWindowMarker'])
|
129
130
|
# just eat the marker - don't output it
|
@@ -140,7 +141,7 @@ class LogStash::Outputs::SCACSV < LogStash::Outputs::File
|
|
140
141
|
|
141
142
|
@formattedPath = event.sprintf(@path)
|
142
143
|
fd = open(@formattedPath)
|
143
|
-
@logger.debug("
|
144
|
+
@logger.debug("PICSVreceive - after opening fd=" + fd.to_s)
|
144
145
|
|
145
146
|
if @recordCount == 0
|
146
147
|
# output header on first line - note, need a minimum of one record for sensible output
|
@@ -243,7 +244,7 @@ class LogStash::Outputs::SCACSV < LogStash::Outputs::File
|
|
243
244
|
begin
|
244
245
|
|
245
246
|
if timestamp.nil? then
|
246
|
-
@logger.debug("
|
247
|
+
@logger.debug("PICSV " + missingString + " for #{group}")
|
247
248
|
elsif timestamp_output_format == "epoch" then
|
248
249
|
outputString = timestamp.to_s
|
249
250
|
elsif timestamp_output_format == "" then
|
@@ -353,7 +354,7 @@ class LogStash::Outputs::SCACSV < LogStash::Outputs::File
|
|
353
354
|
end
|
354
355
|
|
355
356
|
def teardown
|
356
|
-
@logger.debug("
|
357
|
+
@logger.debug("PICSV - Teardown: closing files")
|
357
358
|
|
358
359
|
Thread.kill(@timerThread)
|
359
360
|
closeAndRenameCurrentFile
|
@@ -361,5 +362,5 @@ class LogStash::Outputs::SCACSV < LogStash::Outputs::File
|
|
361
362
|
finished
|
362
363
|
end
|
363
364
|
|
364
|
-
end # class LogStash::Outputs::
|
365
|
+
end # class LogStash::Outputs::PICSV
|
365
366
|
|
@@ -1,17 +1,19 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
|
-
s.name
|
3
|
-
s.version = "1.0.5"
|
4
|
-
s.licenses
|
5
|
-
s.summary
|
2
|
+
s.name = 'logstash-output-picsv'
|
3
|
+
s.version = "1.0.5.1" # 0921@08:05AM
|
4
|
+
s.licenses = ["Apache-2.0"]
|
5
|
+
s.summary = "Receives a stream of events and outputs files meeting the csv format for IBM Operation Analytics Predictive Insights"
|
6
6
|
# Need to validate 1.5 standalone gemfile compatibility; gemfile exists!
|
7
|
-
s.description
|
8
|
-
s.authors
|
9
|
-
s.email
|
10
|
-
s.homepage
|
11
|
-
s.require_paths
|
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"
|
8
|
+
s.authors = ["ORIG:Robert Mckeown, Update:Jim Ray"]
|
9
|
+
s.email = "raygj@us.ibm.com"
|
10
|
+
s.homepage = "https://github.com/raygj/logstash-output-picsv/README.md"
|
11
|
+
s.require_paths = ["lib"]
|
12
12
|
|
13
13
|
# Files
|
14
|
-
s.files = `git ls-files`.split($\)
|
14
|
+
# s.files = `git ls-files`.split($\) # original line
|
15
|
+
s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
|
16
|
+
|
15
17
|
# Tests
|
16
18
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
17
19
|
|
@@ -19,7 +21,9 @@ Gem::Specification.new do |s|
|
|
19
21
|
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "output" }
|
20
22
|
|
21
23
|
# Gem dependencies
|
22
|
-
s.add_runtime_dependency "logstash-core", ">= 1.
|
23
|
-
s.add_runtime_dependency "logstash-codec-plain"
|
24
|
-
s.
|
25
|
-
|
24
|
+
s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
|
25
|
+
s.add_runtime_dependency "logstash-codec-plain"
|
26
|
+
s.add_runtime_dependency "logstash-output-file"
|
27
|
+
s.add_development_dependency "logstash-devutils"
|
28
|
+
|
29
|
+
end
|
data/spec/outputs/picsv_spec.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "logstash/outputs/picsv"
|
1
3
|
require "logstash/devutils/rspec/spec_helper"
|
2
|
-
require "logstash/outputs/base" # changed from /example to /base
|
3
4
|
require "logstash/codecs/plain"
|
4
5
|
require "logstash/event"
|
6
|
+
require "logstash/outputs/file"
|
5
7
|
|
6
|
-
describe LogStash::Outputs::
|
8
|
+
describe LogStash::Outputs::PICSV do
|
7
9
|
let(:sample_event) { LogStash::Event.new }
|
8
|
-
let(:output) { LogStash::Outputs::
|
10
|
+
let(:output) { LogStash::Outputs::PICSV.new }
|
9
11
|
|
10
12
|
before do
|
11
13
|
output.register
|
@@ -18,4 +20,4 @@ describe LogStash::Outputs::Example do
|
|
18
20
|
expect(subject).to eq("Event received")
|
19
21
|
end
|
20
22
|
end
|
21
|
-
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,39 +1,39 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-picsv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.5
|
4
|
+
version: 1.0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ORIG:Robert Mckeown, Update:Jim Ray
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
16
|
- - ">="
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 1.
|
19
|
-
- - "
|
18
|
+
version: '1.60'
|
19
|
+
- - "<="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
22
|
-
name: logstash-core
|
21
|
+
version: '2.99'
|
22
|
+
name: logstash-core-plugin-api
|
23
23
|
prerelease: false
|
24
24
|
type: :runtime
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.
|
30
|
-
- - "
|
29
|
+
version: '1.60'
|
30
|
+
- - "<="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: '2.99'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
35
35
|
requirements:
|
36
|
-
- - "
|
36
|
+
- - ">="
|
37
37
|
- !ruby/object:Gem::Version
|
38
38
|
version: '0'
|
39
39
|
name: logstash-codec-plain
|
@@ -41,13 +41,27 @@ dependencies:
|
|
41
41
|
type: :runtime
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - "
|
44
|
+
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
requirements:
|
50
|
-
- - "
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
name: logstash-output-file
|
54
|
+
prerelease: false
|
55
|
+
type: :runtime
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
51
65
|
- !ruby/object:Gem::Version
|
52
66
|
version: '0'
|
53
67
|
name: logstash-devutils
|
@@ -55,7 +69,7 @@ dependencies:
|
|
55
69
|
type: :development
|
56
70
|
version_requirements: !ruby/object:Gem::Requirement
|
57
71
|
requirements:
|
58
|
-
- - "
|
72
|
+
- - ">="
|
59
73
|
- !ruby/object:Gem::Version
|
60
74
|
version: '0'
|
61
75
|
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
|
@@ -64,10 +78,8 @@ executables: []
|
|
64
78
|
extensions: []
|
65
79
|
extra_rdoc_files: []
|
66
80
|
files:
|
67
|
-
- ".gitignore"
|
68
81
|
- Gemfile
|
69
82
|
- README.md
|
70
|
-
- Rakefile
|
71
83
|
- lib/logstash/outputs/picsv.rb
|
72
84
|
- logstash-output-picsv.gemspec
|
73
85
|
- spec/outputs/picsv_spec.rb
|
data/.gitignore
DELETED
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "logstash/devutils/rake"
|