logstash-output-awslogs 0.1.1 → 0.1.6

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: 20482395ce7059fb5ceb9939d94d8447fe351af6
4
+ data.tar.gz: 67538d248b15197a75495e6642544bfbe3a92f38
5
5
  SHA512:
6
- metadata.gz: 14588c5507ce952bf9215e1890863bde3639483a39eaca1f1181d5ac0e87ea497c45e555f1ce4ffc1f711f35e243e67ae4ee2e28059f6bc4cea8f25928cea4cc
7
- data.tar.gz: 12e2d400a0c16c721ad8bbe878cf66e0bec80a74497a21c87c79c8209a73babbaae7217cf94375dab576699e368f1570db1bd2d8dff802366e7b6474c4a98888
6
+ metadata.gz: e07490bfb631acb80141119de3a34abc789eb3c4fb23e5cc71f5c070dbac11f21b254d54516d18f6ccd60383b9f94e35d4688d0ba79b0c47d70d50e7d3b6fe83
7
+ data.tar.gz: 17ed32f2c494c398618054ce9ed2698848a717a9c1d444e3f82785110a172ea65e5889af1b0b80b79539bff258c57fc5952b67193ebc6ecb5eff01c65d398b8d
@@ -36,7 +36,7 @@ class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
36
36
  end
37
37
  to_send[next_sequence_token_key].push({
38
38
  timestamp: (event.timestamp.time.to_f * 1000).to_int,
39
- message: encoded,
39
+ message: event.get("message"),
40
40
  })
41
41
  end
42
42
  to_send.each do |event_log_names, log_events|
@@ -55,22 +55,43 @@ 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
90
+ rescue Aws::CloudWatchLogs::Errors::ThrottlingException => e
91
+ @logger.info("Logs throttling, wait 1 sec")
92
+ retry
71
93
  end
72
94
  end
73
-
74
95
  begin
75
96
  resp = @client.put_log_events(send_opts)
76
97
  rescue Aws::CloudWatchLogs::Errors::ResourceNotFoundException => e
@@ -91,7 +112,10 @@ class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
91
112
  end
92
113
  retry
93
114
  # TODO: handle rejected events with debug message
94
- @next_sequence_tokens.store(next_sequence_token_key, resp.next_sequence_token)
115
+ @next_sequence_tokens.store(next_sequence_token_key, resp.next_sequence_token)
116
+ rescue Aws::CloudWatchLogs::Errors::ThrottlingException => e
117
+ @logger.info("Logs throttling, wait 1 sec")
118
+ retry
95
119
  end
96
120
  end
97
121
  end # def multi_receive_encoded
@@ -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.6'
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.6
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: []