logstash-output-awslogs 0.1.21 → 0.1.26

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: 583b99ac1c82f6ce8a4062c69e3c5573ee4423c367a50c17ab22f74a7c0a5f94
4
- data.tar.gz: 77dc1748568954518bc4086b5fa4d9b9f30060d2741a4cab129c63485083a3f7
3
+ metadata.gz: 268bd7af65517b4eab80732976110a10662de589fd07108448e1be71b33adfe7
4
+ data.tar.gz: f0861dffc5571fd36deff09aca9f27abc09201be1df7e83582360f54e4a8e0db
5
5
  SHA512:
6
- metadata.gz: d06f504f05c63fbf005395730b2a00c87b82a68c904875997bda8ddfa4ec669ec4a4acc6eae864c64ca4e49cd56d477c1c119f574d4bec3f06a7ee6bd05abfd1
7
- data.tar.gz: 801d5a4a3b8c20edd00f5e7d356f7ac2a0fcafa38a055919ef92f8665d7067dce8ed6e0a1074fe16539770ea8b9ffce7a83538e27a5171e9cff2418a206e4079
6
+ metadata.gz: 41cd461560ed5d827b61e4e560c08754a07255f829805eed9ec36e6a8c669b5eba974c616919d6f8b96093ce3b5f534bd23a1dd81b7a64aa3363d4098534652a
7
+ data.tar.gz: d2388be26aa0bcb7876f88e4fd4e5ae8c67f1cc91d70e0fa0092caecc73674c3370e996b79ad3c6b0d34bd9b786d8ceabbbc20cb9a5d1a0cfbf5fd3f2b83f5a9
@@ -30,7 +30,7 @@ class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
30
30
  to_send = {}
31
31
  sequence_tokens = {}
32
32
 
33
- events_and_encoded.each do |event, _encoded|
33
+ events_and_encoded.each do |event, encoded|
34
34
  event_log_stream_name = event.sprintf(log_stream_name)
35
35
  event_log_group_name = event.sprintf(log_group_name)
36
36
 
@@ -38,15 +38,25 @@ class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
38
38
  unless to_send.keys.include? next_sequence_token_key
39
39
  to_send.store(next_sequence_token_key, [])
40
40
  end
41
- to_send[next_sequence_token_key].push(
42
- timestamp: (event.timestamp.time.to_f * 1000).to_int,
43
- message: event.get('message')
44
- )
41
+ if event.get('message') && !event.get('message').empty?
42
+ to_send[next_sequence_token_key].push(
43
+ timestamp: (event.timestamp.time.to_f * 1000).to_int,
44
+ message: event.get('message')
45
+ )
46
+ else
47
+ to_send[next_sequence_token_key].push(
48
+ timestamp: (event.timestamp.time.to_f * 1000).to_int,
49
+ message: encoded
50
+ )
51
+ end
45
52
  end
46
53
 
47
54
  group_names = []
48
55
  to_send.each do |event_log_names, _events|
49
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
50
60
  unless group_names.include? event_log_group_name
51
61
  group_names.push(event_log_group_name)
52
62
  end
@@ -135,6 +145,9 @@ class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
135
145
  end
136
146
  retry
137
147
  # TODO: handle rejected events with debug message
148
+ rescue Aws::CloudWatchLogs::Errors::InvalidSequenceTokenException => e
149
+ send_opts[:sequence_token] = e.expected_sequence_token
150
+ retry
138
151
  rescue Aws::CloudWatchLogs::Errors::ThrottlingException => e
139
152
  @logger.info('Logs throttling, retry')
140
153
  retry
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-awslogs'
3
- s.version = '0.1.21'
3
+ s.version = '0.1.26'
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'
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.21
4
+ version: 0.1.26
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-17 00:00:00.000000000 Z
11
+ date: 2020-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement