logstash-output-awslogs 0.1.29 → 0.1.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logstash/outputs/awslogs.rb +7 -74
- data/logstash-output-awslogs.gemspec +2 -2
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c474bc4a5ef1f07fa80d864aff9d8117a03e538a1803d5580f568ad247184657
|
4
|
+
data.tar.gz: 3ba1244c07a40439e0720db526d977f50e4927f7880f0d84c99cdee00222be85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85c3a5ed5b1fe574d69d3a120f6e69bec74a2cef47803d089dec0b837c11189391bfc822828f869e32f36c000296df8a216b5cc31a74ed7924b4bd12cd9673a3
|
7
|
+
data.tar.gz: 114a6efe2abb2909f2245bcb92aca3beea9076b809c56374c5ae8099eebc0783a6cc083ef4f7c3c6a3df5046c999e0f4297d5e376e779ddc1fb56b0999c16b1c
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'logstash/outputs/base'
|
4
4
|
require 'logstash/namespace'
|
5
5
|
require 'logstash/plugin_mixins/aws_config'
|
6
|
-
require 'aws-sdk'
|
6
|
+
require 'aws-sdk-cloudwatchlogs'
|
7
7
|
|
8
8
|
Aws.eager_autoload!
|
9
9
|
|
@@ -51,42 +51,6 @@ class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
group_names = []
|
55
|
-
to_send.each do |event_log_names, _events|
|
56
|
-
event_log_group_name = event_log_names[0]
|
57
|
-
event_log_stream_name = event_log_names[1]
|
58
|
-
next_sequence_token_key = [event_log_group_name, event_log_stream_name]
|
59
|
-
next if @next_sequence_tokens.keys.include? next_sequence_token_key
|
60
|
-
unless group_names.include? event_log_group_name
|
61
|
-
group_names.push(event_log_group_name)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
group_names.each do |log_group_name|
|
66
|
-
unless sequence_tokens.keys.include? log_group_name
|
67
|
-
sequence_tokens.store(log_group_name, {})
|
68
|
-
end
|
69
|
-
begin
|
70
|
-
@client.describe_log_streams({log_group_name: log_group_name}).each do |response|
|
71
|
-
response.log_streams.each do |log_stream_data|
|
72
|
-
unless log_stream_data.upload_sequence_token&.empty?
|
73
|
-
sequence_tokens[log_group_name][log_stream_data.log_stream_name.to_s] = log_stream_data.upload_sequence_token.to_s
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
rescue Aws::CloudWatchLogs::Errors::ResourceNotFoundException => e
|
78
|
-
@logger.info("Will create log group #{log_group_name} and retry")
|
79
|
-
begin
|
80
|
-
@client.create_log_group({log_group_name: log_group_name})
|
81
|
-
rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException => e
|
82
|
-
@logger.info("Log group #{log_group_name} already exists")
|
83
|
-
end
|
84
|
-
retry
|
85
|
-
rescue Aws::CloudWatchLogs::Errors::ThrottlingException => e
|
86
|
-
@logger.info('Describe streams throttling, retry')
|
87
|
-
retry
|
88
|
-
end
|
89
|
-
end
|
90
54
|
|
91
55
|
to_send.each do |event_log_names, log_events|
|
92
56
|
event_log_group_name = event_log_names[0]
|
@@ -103,11 +67,9 @@ class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
|
|
103
67
|
|
104
68
|
if @next_sequence_tokens.keys.include? next_sequence_token_key
|
105
69
|
send_opts[:sequence_token] = @next_sequence_tokens[next_sequence_token_key]
|
106
|
-
elsif !sequence_tokens[event_log_group_name][event_log_stream_name]&.empty?
|
107
|
-
send_opts[:sequence_token] = sequence_tokens[event_log_group_name][event_log_stream_name]
|
108
|
-
else
|
109
70
|
begin
|
110
|
-
@client.
|
71
|
+
resp = @client.put_log_events(send_opts)
|
72
|
+
@next_sequence_tokens.store(next_sequence_token_key, resp.next_sequence_token)
|
111
73
|
rescue Aws::CloudWatchLogs::Errors::ResourceNotFoundException => e
|
112
74
|
@logger.info('Will create log group/stream and retry')
|
113
75
|
begin
|
@@ -121,42 +83,13 @@ class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
|
|
121
83
|
@logger.info("Log stream #{send_opts[:log_stream_name]} already exists")
|
122
84
|
end
|
123
85
|
retry
|
86
|
+
rescue Aws::CloudWatchLogs::Errors::InvalidSequenceTokenException => e
|
87
|
+
send_opts[:sequence_token] = e.expected_sequence_token
|
88
|
+
retry
|
124
89
|
rescue Aws::CloudWatchLogs::Errors::ThrottlingException => e
|
125
|
-
@logger.info('
|
90
|
+
@logger.info('Logs throttling, retry')
|
126
91
|
retry
|
127
|
-
rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException => e
|
128
|
-
@logger.info("Log stream #{send_opts[:log_stream_name]} already exists")
|
129
|
-
end
|
130
|
-
end
|
131
|
-
begin
|
132
|
-
resp = @client.put_log_events(send_opts)
|
133
|
-
@next_sequence_tokens.store(next_sequence_token_key, resp.next_sequence_token)
|
134
|
-
rescue Aws::CloudWatchLogs::Errors::ResourceNotFoundException => e
|
135
|
-
@logger.info('Will create log group/stream and retry')
|
136
|
-
begin
|
137
|
-
@client.create_log_group({log_group_name: send_opts[:log_group_name]})
|
138
|
-
rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException => e
|
139
|
-
@logger.info("Log group #{send_opts[:log_group_name]} already exists")
|
140
|
-
end
|
141
|
-
begin
|
142
|
-
@client.create_log_stream({log_group_name: send_opts[:log_group_name], log_stream_name: send_opts[:log_stream_name]})
|
143
|
-
rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException => e
|
144
|
-
@logger.info("Log stream #{send_opts[:log_stream_name]} already exists")
|
145
|
-
end
|
146
|
-
retry
|
147
|
-
rescue Aws::CloudWatchLogs::Errors::InvalidSequenceTokenException => e
|
148
|
-
@logger.info(e.code)
|
149
|
-
response = @client.describe_log_streams({log_group_name: send_opts[:log_group_name], log_stream_name_prefix: send_opts[:log_stream_name]})
|
150
|
-
response.log_streams.each do |stream_data|
|
151
|
-
if stream_data.log_stream_name == send_opts[:log_stream_name]
|
152
|
-
send_opts[:sequence_token] = stream_data.upload_sequence_token
|
153
|
-
break
|
154
|
-
end
|
155
92
|
end
|
156
|
-
retry
|
157
|
-
rescue Aws::CloudWatchLogs::Errors::ThrottlingException => e
|
158
|
-
@logger.info('Logs throttling, retry')
|
159
|
-
retry
|
160
93
|
end
|
161
94
|
end
|
162
95
|
end # def multi_receive_encodeds
|
@@ -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.30'
|
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'
|
@@ -20,6 +20,6 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0"
|
21
21
|
s.add_runtime_dependency "logstash-codec-plain"
|
22
22
|
s.add_runtime_dependency 'logstash-mixin-aws', '>= 4.3.0'
|
23
|
+
s.add_runtime_dependency "aws-sdk-cloudwatchlogs", '~> 1'
|
23
24
|
s.add_development_dependency "logstash-devutils"
|
24
|
-
s.add_development_dependency "aws-sdk-cloudwatchlogs"
|
25
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Klyba
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -55,24 +55,24 @@ dependencies:
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- - "
|
58
|
+
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
61
|
-
name:
|
60
|
+
version: '1'
|
61
|
+
name: aws-sdk-cloudwatchlogs
|
62
62
|
prerelease: false
|
63
|
-
type: :
|
63
|
+
type: :runtime
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
|
-
name:
|
75
|
+
name: logstash-devutils
|
76
76
|
prerelease: false
|
77
77
|
type: :development
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|