logstash-output-awslogs 0.1.17 → 0.1.22

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
- SHA1:
3
- metadata.gz: d401b9bf9bdc4cfbfcbfc67d15149c7808436cd7
4
- data.tar.gz: 13457ea56d4948e7ba7e3dbffe01cc16054bf538
2
+ SHA256:
3
+ metadata.gz: 9584b5be53cc5cd5f7397547f5fa880085c55ab14a37cba3bb16684976ddeda3
4
+ data.tar.gz: 88796ea88b9cd8d735cd5f185c0b9c98e4d14ffb3927f6eaf1a6db1d83a3228e
5
5
  SHA512:
6
- metadata.gz: 2c592f05a971d09885c57092d163a0e05385c933cf74cd9db938f0b5c9a213dce542ed3636e73cd0afdcb4c56c9aa55f5af9415a59f08d075afb202c686f1604
7
- data.tar.gz: 20736d09febf105024425cf86621948dd9a9d98b97901151f5fa2717e168d9b703a4569deb82d820fc3ef5074ae8b584c4d3e04dec0820d89cdd0eca9ce754a5
6
+ metadata.gz: 93c208b2978085d69009ed77471980b37488a51079c8013582e3a75f46820935965f009388eed5754c5bd496aacceda060c2e8b553f911b2848579c3323ce55c
7
+ data.tar.gz: 6738e1b4ee6b31fbe90ede296da1ee55eb0dd1f2205163aed267d0e4ead370ad7e0bc54550bda8b978f4f7f1d3ba63768487c2039af04b059022cf9511679237
data/Gemfile CHANGED
@@ -1,3 +1,2 @@
1
1
  source 'https://rubygems.org'
2
- gemspec
3
- gem "logstash", :github => "elastic/logstash", :branch => "6.4"
2
+ gemspec
@@ -44,23 +44,35 @@ class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
44
44
  )
45
45
  end
46
46
 
47
+ group_names = []
47
48
  to_send.each do |event_log_names, _events|
48
49
  event_log_group_name = event_log_names[0]
49
- next if sequence_tokens.keys.include? event_log_group_name
50
+ event_log_stream_name = event_log_names[1]
51
+ next_sequence_token_key = [event_log_group_name, event_log_stream_name]
52
+ next if @next_sequence_tokens.keys.include? next_sequence_token_key
53
+ unless group_names.include? event_log_group_name
54
+ group_names.push(event_log_group_name)
55
+ end
56
+ end
50
57
 
51
- sequence_tokens.store(event_log_group_name, {})
58
+ group_names.each do |log_group_name|
59
+ unless sequence_tokens.keys.include? log_group_name
60
+ sequence_tokens.store(log_group_name, {})
61
+ end
52
62
  begin
53
- @client.describe_log_streams({log_group_name: event_log_group_name}).each do |response|
63
+ @client.describe_log_streams({log_group_name: log_group_name}).each do |response|
54
64
  response.log_streams.each do |log_stream_data|
55
- sequence_tokens[event_log_group_name][log_stream_data.log_stream_name.to_s] = log_stream_data.upload_sequence_token.to_s
65
+ unless log_stream_data.upload_sequence_token&.empty?
66
+ sequence_tokens[log_group_name][log_stream_data.log_stream_name.to_s] = log_stream_data.upload_sequence_token.to_s
67
+ end
56
68
  end
57
69
  end
58
70
  rescue Aws::CloudWatchLogs::Errors::ResourceNotFoundException => e
59
- @logger.info('Will create log group/stream and retry')
71
+ @logger.info("Will create log group #{log_group_name} and retry")
60
72
  begin
61
- @client.create_log_group({log_group_name: event_log_group_name})
73
+ @client.create_log_group({log_group_name: log_group_name})
62
74
  rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException => e
63
- @logger.info("Log group #{event_log_group_name} already exists")
75
+ @logger.info("Log group #{log_group_name} already exists")
64
76
  end
65
77
  retry
66
78
  rescue Aws::CloudWatchLogs::Errors::ThrottlingException => e
@@ -84,7 +96,7 @@ class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
84
96
 
85
97
  if @next_sequence_tokens.keys.include? next_sequence_token_key
86
98
  send_opts[:sequence_token] = @next_sequence_tokens[next_sequence_token_key]
87
- elsif sequence_tokens[event_log_group_name].keys.include? event_log_stream_name
99
+ elsif !sequence_tokens[event_log_group_name][event_log_stream_name]&.empty?
88
100
  send_opts[:sequence_token] = sequence_tokens[event_log_group_name][event_log_stream_name]
89
101
  else
90
102
  begin
@@ -105,6 +117,8 @@ class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
105
117
  rescue Aws::CloudWatchLogs::Errors::ThrottlingException => e
106
118
  @logger.info('Creating log streams throttling, retry')
107
119
  retry
120
+ rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException => e
121
+ @logger.info("Log stream #{send_opts[:log_stream_name]} already exists")
108
122
  end
109
123
  end
110
124
  begin
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-awslogs'
3
- s.version = '0.1.17'
3
+ s.version = '0.1.22'
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.17
4
+ version: 0.1.22
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
- type: :runtime
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
- type: :runtime
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
- type: :runtime
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.5.2.3
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: []