logstash-output-awslogs 0.1.27 → 0.1.28

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: b101283f4c71649578a073eac435ecfc727cff3e2cbfea45458e64566b5a42aa
4
- data.tar.gz: a7ab59be3ca3ca945f52dbb374764c8e869bb724b7e5e8f27c5bf01380a7b708
3
+ metadata.gz: 4fb080097b3946429995c6e7e7f937a4f05bd416c9c21060186af4237cfd8f5a
4
+ data.tar.gz: 6c0d9183dc2e0aa601f74c7202033160f2fe9ed29f616342c09db2b82c7a3b42
5
5
  SHA512:
6
- metadata.gz: a44eef076664b96349d4da5d4178e997ba4cd838f11b54d85e000b21c5cdaa02a6543afc9d552c63f12752a55d6666a7b4c36d7c3e671da444908e16088b582a
7
- data.tar.gz: 1f0d095dd7fe53c97b8d88b0ce80054f7b45c69fcd9abc109332c89b9299881191b0e94a889b0ce32cf86b7d7bed5359092b14bea3154d37ead7667403490ead
6
+ metadata.gz: 780c474b5299be93ed86071830ed410deb327d118c0d10c2952d350c31fd771fe88d1f9a7fffe36206134fdf9811076984b96617eb3e056826e38a5f63cf46d3
7
+ data.tar.gz: 3dbe092d6b64511a997879d595d56d6221b8d106e4c8b97e92fe08545364825b4feca4b8a48f0e75bbb6e0db8b5c545c1421dfc151d1369f8f8ee43d48c6329c
data/Gemfile CHANGED
@@ -1,2 +1,2 @@
1
1
  source 'https://rubygems.org'
2
- gemspec
2
+ gemspec
@@ -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
 
@@ -28,7 +28,6 @@ class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
28
28
 
29
29
  def multi_receive_encoded(events_and_encoded)
30
30
  to_send = {}
31
- sequence_tokens = {}
32
31
 
33
32
  events_and_encoded.each do |event, encoded|
34
33
  event_log_stream_name = event.sprintf(log_stream_name)
@@ -51,43 +50,6 @@ class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
51
50
  end
52
51
  end
53
52
 
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
-
91
53
  to_send.each do |event_log_names, log_events|
92
54
  event_log_group_name = event_log_names[0]
93
55
  event_log_stream_name = event_log_names[1]
@@ -103,53 +65,30 @@ class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
103
65
 
104
66
  if @next_sequence_tokens.keys.include? next_sequence_token_key
105
67
  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
68
  else
109
69
  begin
110
- @client.create_log_stream(ident_opts)
111
- rescue Aws::CloudWatchLogs::Errors::ResourceNotFoundException => e
70
+ resp = @client.put_log_events(send_opts)
71
+ @next_sequence_tokens.store(next_sequence_token_key, resp.next_sequence_token)
72
+ rescue Aws::CloudWatchLogs::Errors::ResourceNotFoundException => _e
112
73
  @logger.info('Will create log group/stream and retry')
113
74
  begin
114
75
  @client.create_log_group({log_group_name: send_opts[:log_group_name]})
115
- rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException => e
76
+ rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException => _e
116
77
  @logger.info("Log group #{send_opts[:log_group_name]} already exists")
117
78
  end
118
79
  begin
119
80
  @client.create_log_stream({log_group_name: send_opts[:log_group_name], log_stream_name: send_opts[:log_stream_name]})
120
- rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException => e
81
+ rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException => _e
121
82
  @logger.info("Log stream #{send_opts[:log_stream_name]} already exists")
122
83
  end
123
84
  retry
124
- rescue Aws::CloudWatchLogs::Errors::ThrottlingException => e
125
- @logger.info('Creating log streams throttling, retry')
85
+ rescue Aws::CloudWatchLogs::Errors::InvalidSequenceTokenException => e
86
+ send_opts[:sequence_token] = e.expected_sequence_token
87
+ retry
88
+ rescue Aws::CloudWatchLogs::Errors::LimitExceededException => e
89
+ @logger.info('Logs throttling, retry')
126
90
  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
91
  end
146
- retry
147
- rescue Aws::CloudWatchLogs::Errors::InvalidSequenceTokenException => e
148
- send_opts[:sequence_token] = e[:expected_sequence_token]
149
- retry
150
- rescue Aws::CloudWatchLogs::Errors::ThrottlingException => e
151
- @logger.info('Logs throttling, retry')
152
- retry
153
92
  end
154
93
  end
155
94
  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.27'
3
+ s.version = '0.1.28'
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'
23
24
  s.add_development_dependency "logstash-devutils"
24
- s.add_development_dependency "aws-sdk-cloudwatchlogs"
25
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-awslogs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.27
4
+ version: 0.1.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Klyba
@@ -58,9 +58,9 @@ dependencies:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
- name: logstash-devutils
61
+ name: aws-sdk-cloudwatchlogs
62
62
  prerelease: false
63
- type: :development
63
+ type: :runtime
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
@@ -72,7 +72,7 @@ dependencies:
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
- name: aws-sdk-cloudwatchlogs
75
+ name: logstash-devutils
76
76
  prerelease: false
77
77
  type: :development
78
78
  version_requirements: !ruby/object:Gem::Requirement