logstash-output-awslogs 0.1.13 → 0.1.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +1 -2
- data/lib/logstash/outputs/awslogs.rb +13 -39
- data/logstash-output-awslogs.gemspec +2 -1
- metadata +28 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f3d5efa67caa9e211e21e71fede063e658c4b44c274d29a6838258b58b3c285f
|
4
|
+
data.tar.gz: 6fd435720e928b70ccbd48679cc2d1dead030260f3c8d63eb86c563202820221
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa5742ed53757059341e61f2522a227a9bfd980e3301a5d2b5fce7fb78da1b60fbe0d649d115cfc573ec1f0db57c1ccc9802a32d4ca1d70929e525add86a801c
|
7
|
+
data.tar.gz: 02a4eda07a4c87c926947b07c568e3b7b8c2342aeec5a50a47d6edf34d389309437bc4f2e7561071cba858dc06ccf7188becc128db7fa8986e94b8dd83139054
|
data/Gemfile
CHANGED
@@ -46,35 +46,27 @@ class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
|
|
46
46
|
|
47
47
|
to_send.each do |event_log_names, _events|
|
48
48
|
event_log_group_name = event_log_names[0]
|
49
|
-
event_log_stream_name = event_log_names[1]
|
50
49
|
next if sequence_tokens.keys.include? event_log_group_name
|
51
50
|
|
52
51
|
sequence_tokens.store(event_log_group_name, {})
|
53
52
|
begin
|
54
|
-
@client.describe_log_streams(log_group_name: event_log_group_name).each do |response|
|
53
|
+
@client.describe_log_streams({log_group_name: event_log_group_name}).each do |response|
|
55
54
|
response.log_streams.each do |log_stream_data|
|
56
|
-
|
55
|
+
unless log_stream_data.upload_sequence_token.empty?
|
56
|
+
sequence_tokens[event_log_group_name][log_stream_data.log_stream_name.to_s] = log_stream_data.upload_sequence_token.to_s
|
57
|
+
end
|
57
58
|
end
|
58
59
|
end
|
59
60
|
rescue Aws::CloudWatchLogs::Errors::ResourceNotFoundException => e
|
60
61
|
@logger.info('Will create log group/stream and retry')
|
61
62
|
begin
|
62
|
-
@client.create_log_group(log_group_name: event_log_group_name)
|
63
|
+
@client.create_log_group({log_group_name: event_log_group_name})
|
63
64
|
rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException => e
|
64
65
|
@logger.info("Log group #{event_log_group_name} already exists")
|
65
|
-
rescue Exception => e
|
66
|
-
@logger.error(e)
|
67
|
-
end
|
68
|
-
begin
|
69
|
-
@client.create_log_stream(log_group_name: event_log_group_name, log_stream_name: event_log_stream_name)
|
70
|
-
rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException => e
|
71
|
-
@logger.info("Log stream #{event_log_stream_name} already exists")
|
72
|
-
rescue Exception => e
|
73
|
-
@logger.error(e)
|
74
66
|
end
|
75
67
|
retry
|
76
68
|
rescue Aws::CloudWatchLogs::Errors::ThrottlingException => e
|
77
|
-
@logger.info('
|
69
|
+
@logger.info('Describe streams throttling, retry')
|
78
70
|
retry
|
79
71
|
end
|
80
72
|
end
|
@@ -94,68 +86,50 @@ class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
|
|
94
86
|
|
95
87
|
if @next_sequence_tokens.keys.include? next_sequence_token_key
|
96
88
|
send_opts[:sequence_token] = @next_sequence_tokens[next_sequence_token_key]
|
97
|
-
elsif sequence_tokens[event_log_group_name].keys.include? event_log_stream_name
|
89
|
+
elsif sequence_tokens[event_log_group_name].keys.include? event_log_stream_name && !sequence_tokens[event_log_group_name][event_log_stream_name].empty?
|
98
90
|
send_opts[:sequence_token] = sequence_tokens[event_log_group_name][event_log_stream_name]
|
99
91
|
else
|
100
92
|
begin
|
101
93
|
@client.create_log_stream(ident_opts)
|
102
|
-
until sequence_tokens[event_log_group_name][event_log_stream_name] do
|
103
|
-
@client.describe_log_streams(log_group_name: event_log_group_name).each do |response|
|
104
|
-
response.log_streams.each do |log_stream_data|
|
105
|
-
sequence_tokens[event_log_group_name][log_stream_data.log_stream_name.to_s] = log_stream_data.upload_sequence_token.to_s
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
send_opts[:sequence_token] = sequence_tokens[event_log_group_name][event_log_stream_name]
|
110
94
|
rescue Aws::CloudWatchLogs::Errors::ResourceNotFoundException => e
|
111
95
|
@logger.info('Will create log group/stream and retry')
|
112
96
|
begin
|
113
|
-
@client.create_log_group(log_group_name: send_opts[:log_group_name])
|
97
|
+
@client.create_log_group({log_group_name: send_opts[:log_group_name]})
|
114
98
|
rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException => e
|
115
99
|
@logger.info("Log group #{send_opts[:log_group_name]} already exists")
|
116
|
-
rescue Exception => e
|
117
|
-
@logger.error(e)
|
118
100
|
end
|
119
101
|
begin
|
120
|
-
@client.create_log_stream(log_group_name: send_opts[:log_group_name], log_stream_name: send_opts[:log_stream_name])
|
102
|
+
@client.create_log_stream({log_group_name: send_opts[:log_group_name], log_stream_name: send_opts[:log_stream_name]})
|
121
103
|
rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException => e
|
122
104
|
@logger.info("Log stream #{send_opts[:log_stream_name]} already exists")
|
123
|
-
rescue Exception => e
|
124
|
-
@logger.error(e)
|
125
105
|
end
|
126
106
|
retry
|
127
107
|
rescue Aws::CloudWatchLogs::Errors::ThrottlingException => e
|
128
|
-
@logger.info('
|
108
|
+
@logger.info('Creating log streams throttling, retry')
|
129
109
|
retry
|
130
110
|
end
|
131
111
|
end
|
132
112
|
begin
|
133
113
|
resp = @client.put_log_events(send_opts)
|
114
|
+
@next_sequence_tokens.store(next_sequence_token_key, resp.next_sequence_token)
|
134
115
|
rescue Aws::CloudWatchLogs::Errors::ResourceNotFoundException => e
|
135
116
|
@logger.info('Will create log group/stream and retry')
|
136
117
|
begin
|
137
|
-
@client.create_log_group(log_group_name: send_opts[:log_group_name])
|
118
|
+
@client.create_log_group({log_group_name: send_opts[:log_group_name]})
|
138
119
|
rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException => e
|
139
120
|
@logger.info("Log group #{send_opts[:log_group_name]} already exists")
|
140
|
-
rescue Exception => e
|
141
|
-
@logger.error(e)
|
142
121
|
end
|
143
122
|
begin
|
144
|
-
@client.create_log_stream(log_group_name: send_opts[:log_group_name], log_stream_name: send_opts[:log_stream_name])
|
123
|
+
@client.create_log_stream({log_group_name: send_opts[:log_group_name], log_stream_name: send_opts[:log_stream_name]})
|
145
124
|
rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException => e
|
146
125
|
@logger.info("Log stream #{send_opts[:log_stream_name]} already exists")
|
147
|
-
rescue Exception => e
|
148
|
-
@logger.error(e)
|
149
126
|
end
|
150
127
|
retry
|
151
128
|
# TODO: handle rejected events with debug message
|
152
129
|
rescue Aws::CloudWatchLogs::Errors::ThrottlingException => e
|
153
130
|
@logger.info('Logs throttling, retry')
|
154
131
|
retry
|
155
|
-
rescue Exception => e
|
156
|
-
@logger.error("Err: #{e}; Opts: #{send_opts.each { |k,v| "#{k.to_s} : #{v.to_s}" }}")
|
157
132
|
end
|
158
|
-
@next_sequence_tokens.store(next_sequence_token_key, resp.next_sequence_token)
|
159
133
|
end
|
160
134
|
end # def multi_receive_encoded
|
161
135
|
end # class LogStash::Outputs::Awslogs
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-awslogs'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.18'
|
4
4
|
s.licenses = ['Apache-2.0']
|
5
5
|
s.summary = 'Writes events to AWS CloudWatch logs.'
|
6
6
|
s.homepage = 'https://github.com/rickycook/logstash-output-awslogs'
|
@@ -21,4 +21,5 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.add_runtime_dependency "logstash-codec-plain"
|
22
22
|
s.add_runtime_dependency 'logstash-mixin-aws', '>= 4.3.0'
|
23
23
|
s.add_development_dependency "logstash-devutils"
|
24
|
+
s.add_development_dependency "aws-sdk-cloudwatchlogs"
|
24
25
|
end
|
metadata
CHANGED
@@ -1,72 +1,86 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-awslogs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Klyba
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2020-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: logstash-core-plugin-api
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
16
|
- - "~>"
|
18
17
|
- !ruby/object:Gem::Version
|
19
18
|
version: '2.0'
|
20
|
-
|
19
|
+
name: logstash-core-plugin-api
|
21
20
|
prerelease: false
|
21
|
+
type: :runtime
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: logstash-codec-plain
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
30
29
|
requirements:
|
31
30
|
- - ">="
|
32
31
|
- !ruby/object:Gem::Version
|
33
32
|
version: '0'
|
34
|
-
|
33
|
+
name: logstash-codec-plain
|
35
34
|
prerelease: false
|
35
|
+
type: :runtime
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: logstash-mixin-aws
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
44
43
|
requirements:
|
45
44
|
- - ">="
|
46
45
|
- !ruby/object:Gem::Version
|
47
46
|
version: 4.3.0
|
48
|
-
|
47
|
+
name: logstash-mixin-aws
|
49
48
|
prerelease: false
|
49
|
+
type: :runtime
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 4.3.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: logstash-devutils
|
57
56
|
requirement: !ruby/object:Gem::Requirement
|
58
57
|
requirements:
|
59
58
|
- - ">="
|
60
59
|
- !ruby/object:Gem::Version
|
61
60
|
version: '0'
|
61
|
+
name: logstash-devutils
|
62
|
+
prerelease: false
|
62
63
|
type: :development
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
name: aws-sdk-cloudwatchlogs
|
63
76
|
prerelease: false
|
77
|
+
type: :development
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
|
-
description:
|
83
|
+
description:
|
70
84
|
email: anarhyst266+gems@gmail.com
|
71
85
|
executables: []
|
72
86
|
extensions: []
|
@@ -86,7 +100,7 @@ licenses:
|
|
86
100
|
metadata:
|
87
101
|
logstash_plugin: 'true'
|
88
102
|
logstash_group: output
|
89
|
-
post_install_message:
|
103
|
+
post_install_message:
|
90
104
|
rdoc_options: []
|
91
105
|
require_paths:
|
92
106
|
- lib
|
@@ -101,9 +115,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
115
|
- !ruby/object:Gem::Version
|
102
116
|
version: '0'
|
103
117
|
requirements: []
|
104
|
-
rubyforge_project:
|
105
|
-
rubygems_version: 2.
|
106
|
-
signing_key:
|
118
|
+
rubyforge_project:
|
119
|
+
rubygems_version: 2.6.11
|
120
|
+
signing_key:
|
107
121
|
specification_version: 4
|
108
122
|
summary: Writes events to AWS CloudWatch logs.
|
109
123
|
test_files: []
|