logstash-output-awslogs 0.1.0 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logstash/outputs/awslogs.rb +55 -15
- data/logstash-output-awslogs.gemspec +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca546d819e0b7380e5c3e223f734b73b539b7ec7
|
4
|
+
data.tar.gz: 33415c58330218021b79dfb305a265d034e5e20f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc483aea49fee409283373d3db6a8bb7af82269324eee605a9bf8d14c17947aeec4c9b653305ca724a8238912576a8337ce7c8c9e76fb0c28eb664b4c823b9a6
|
7
|
+
data.tar.gz: e47bf343fa1eae53da1316475e5f8e85299b8360a6932a1d5db019e26509e67df471783af7a089959842ba093c839e07901a95ef6abcd7335ef61b407366bc15
|
@@ -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:
|
39
|
+
message: event.get("message"),
|
40
40
|
})
|
41
41
|
end
|
42
42
|
to_send.each do |event_log_names, log_events|
|
@@ -55,25 +55,65 @@ 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
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
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
|
-
|
75
|
-
|
92
|
+
begin
|
93
|
+
resp = @client.put_log_events(send_opts)
|
94
|
+
rescue Aws::CloudWatchLogs::Errors::ResourceNotFoundException => e
|
95
|
+
@logger.info("Will create log group/stream and retry")
|
96
|
+
begin
|
97
|
+
@client.create_log_group(:log_group_name => send_opts[:log_group_name])
|
98
|
+
rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException => e
|
99
|
+
@logger.info("Log group #{send_opts[:log_group_name]} already exists")
|
100
|
+
rescue Exception => e
|
101
|
+
@logger.error(e)
|
102
|
+
end
|
103
|
+
begin
|
104
|
+
@client.create_log_stream(:log_group_name => send_opts[:log_group_name], :log_stream_name => send_opts[:log_stream_name])
|
105
|
+
rescue Aws::CloudWatchLogs::Errors::ResourceAlreadyExistsException => e
|
106
|
+
@logger.info("Log stream #{send_opts[:log_stream_name]} already exists")
|
107
|
+
rescue Exception => e
|
108
|
+
@logger.error(e)
|
109
|
+
end
|
110
|
+
retry
|
111
|
+
# TODO: handle rejected events with debug message
|
76
112
|
@next_sequence_tokens.store(next_sequence_token_key, resp.next_sequence_token)
|
113
|
+
rescue Aws::CloudWatchLogs::Errors::ThrottlingException => e
|
114
|
+
@logger.info("Logs throttling, wait 1 sec")
|
115
|
+
retry
|
116
|
+
end
|
77
117
|
end
|
78
118
|
end # def multi_receive_encoded
|
79
119
|
end # class LogStash::Outputs::Awslogs
|
@@ -1,11 +1,11 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-awslogs'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.5'
|
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 = ['
|
8
|
-
s.email = '
|
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.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
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:
|
70
|
+
email: anarhyst266+gems@gmail.com
|
71
71
|
executables: []
|
72
72
|
extensions: []
|
73
73
|
extra_rdoc_files: []
|