logstash-output-awslogs 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: 50f48258fe09e94a5d4cd1d0b80b63d80e2c6924
4
- data.tar.gz: '019fc72122f4a6f43ef6953db6a18a8e62f35633'
3
+ metadata.gz: b51111e0c86640d2277aa954226775fed704db91
4
+ data.tar.gz: a24601a758c08e51c1916ffcc6154a878a856916
5
5
  SHA512:
6
- metadata.gz: 14588c5507ce952bf9215e1890863bde3639483a39eaca1f1181d5ac0e87ea497c45e555f1ce4ffc1f711f35e243e67ae4ee2e28059f6bc4cea8f25928cea4cc
7
- data.tar.gz: 12e2d400a0c16c721ad8bbe878cf66e0bec80a74497a21c87c79c8209a73babbaae7217cf94375dab576699e368f1570db1bd2d8dff802366e7b6474c4a98888
6
+ metadata.gz: 0cd0ccdb05a9db744383faa4b9985b353f1b20e7cd0f0813bcc12229bd54e8685f58306797bdae3e1f9ec79e450ae66d76a5f47f62a3ced88a55211e88cb3f77
7
+ data.tar.gz: 5d7eca9d558c504f482e36dff72ca688e8460c38d68e101b9a776afd6be8eddeb62fff27634e3af0862ed9ead45fd089723f87830a55bdf866e0868567e1ffd8
@@ -55,22 +55,40 @@ class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
55
55
  if @next_sequence_tokens.keys.include? next_sequence_token_key
56
56
  send_opts[:sequence_token] = @next_sequence_tokens[next_sequence_token_key]
57
57
  else
58
- resp = @client.describe_log_streams({
59
- log_group_name: event_log_group_name,
60
- log_stream_name_prefix: event_log_stream_name,
61
- })
62
- if resp.log_streams.length < 1
63
- @client.create_log_stream(ident_opts)
64
- else
65
- resp.log_streams.each do |log_stream_data|
66
- if log_stream_data.log_stream_name == event_log_stream_name
67
- send_opts[:sequence_token] = log_stream_data.upload_sequence_token
68
- break
58
+ begin
59
+ resp = @client.describe_log_streams({
60
+ log_group_name: event_log_group_name,
61
+ log_stream_name_prefix: event_log_stream_name,
62
+ })
63
+ if resp.log_streams.length < 1
64
+ @client.create_log_stream(ident_opts)
65
+ else
66
+ resp.log_streams.each do |log_stream_data|
67
+ if log_stream_data.log_stream_name == event_log_stream_name
68
+ send_opts[:sequence_token] = log_stream_data.upload_sequence_token
69
+ break
70
+ end
69
71
  end
70
72
  end
73
+ rescue Aws::CloudWatchLogs::Errors::ResourceNotFoundException => e
74
+ @logger.info("Will create log group/stream and retry")
75
+ begin
76
+ @client.create_log_group(:log_group_name => send_opts[:log_group_name])
77
+ rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException => e
78
+ @logger.info("Log group #{send_opts[:log_group_name]} already exists")
79
+ rescue Exception => e
80
+ @logger.error(e)
81
+ end
82
+ begin
83
+ @client.create_log_stream(:log_group_name => send_opts[:log_group_name], :log_stream_name => send_opts[:log_stream_name])
84
+ rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException => e
85
+ @logger.info("Log stream #{send_opts[:log_stream_name]} already exists")
86
+ rescue Exception => e
87
+ @logger.error(e)
88
+ end
89
+ retry
71
90
  end
72
91
  end
73
-
74
92
  begin
75
93
  resp = @client.put_log_events(send_opts)
76
94
  rescue Aws::CloudWatchLogs::Errors::ResourceNotFoundException => e
@@ -1,11 +1,11 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-awslogs'
3
- s.version = '0.1.1'
3
+ s.version = '0.1.2'
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'
7
- s.authors = ['Ricky Cook']
8
- s.email = 'logstash-output-awslogs@auto.thatpanda.com'
7
+ s.authors = ['Anton Klyba']
8
+ s.email = 'anarhyst266+gems@gmail.com'
9
9
  s.require_paths = ['lib']
10
10
 
11
11
  # Files
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-awslogs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
- - Ricky Cook
7
+ - Anton Klyba
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description:
70
- email: logstash-output-awslogs@auto.thatpanda.com
70
+ email: anarhyst266+gems@gmail.com
71
71
  executables: []
72
72
  extensions: []
73
73
  extra_rdoc_files: []