logstash-output-awslogs 1.1.3 → 1.1.4
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 +10 -4
- data/logstash-output-awslogs.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d89bf2683352b8d8e1dfb360760e5129db4d0bcfb447bea11101c3dc7648b11
|
4
|
+
data.tar.gz: 64e3749306d9da99ff81ca006bfb2e7c34255981b75119ee238d00b149e379f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc23ff3640ec9526027a3a1de59329dc00fedf2722602eca9e71ac4081007ad029e38391fe40a9895821aecd3e0f938c7f4f92c9f3139bee3a6410a640e8fffc
|
7
|
+
data.tar.gz: ce9e61a5e8d17bdb8aaa3a61bce0d7510f7547bc01327579263a9494cf110a8646d271d11b087bf915f035aa0de107f1a35eaa798f36306a546b9648ced32427
|
@@ -4,6 +4,7 @@ require 'logstash/outputs/base'
|
|
4
4
|
require 'logstash/namespace'
|
5
5
|
require 'logstash/plugin_mixins/aws_config'
|
6
6
|
require 'aws-sdk-cloudwatchlogs'
|
7
|
+
require 'time'
|
7
8
|
|
8
9
|
|
9
10
|
class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
|
@@ -15,6 +16,7 @@ class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
|
|
15
16
|
|
16
17
|
PER_EVENT_OVERHEAD = 26
|
17
18
|
MAX_BATCH_SIZE = 1024 * 1024
|
19
|
+
MIN_DELAY = 0.2
|
18
20
|
|
19
21
|
# Log group to send event to
|
20
22
|
config :log_group_name, validate: :string, required: true
|
@@ -26,6 +28,7 @@ class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
|
|
26
28
|
public
|
27
29
|
def register
|
28
30
|
@client = Aws::CloudWatchLogs::Client.new(aws_options_hash)
|
31
|
+
@last_flush = Time.now.to_f
|
29
32
|
end # def register
|
30
33
|
|
31
34
|
public
|
@@ -39,6 +42,8 @@ class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
|
|
39
42
|
private
|
40
43
|
def put_events(batch)
|
41
44
|
begin
|
45
|
+
delay = MIN_DELAY - (Time.now.to_f - @last_flush)
|
46
|
+
sleep(delay) if delay > 0
|
42
47
|
@client.put_log_events(
|
43
48
|
{
|
44
49
|
log_group_name: batch[:log_group],
|
@@ -60,16 +65,17 @@ class LogStash::Outputs::Awslogs < LogStash::Outputs::Base
|
|
60
65
|
end
|
61
66
|
retry
|
62
67
|
end
|
68
|
+
rescue Aws::CloudWatchLogs::Errors::LimitExceededException
|
69
|
+
@logger.info("AWSLogs: Rate limit exceeded, retrying")
|
70
|
+
retry
|
71
|
+
end
|
72
|
+
@last_flush = Time.now.to_f
|
63
73
|
end
|
64
74
|
|
65
75
|
private
|
66
76
|
def form_event_batches(events_arr)
|
67
77
|
batches = []
|
68
78
|
events_by_stream_and_group = {}
|
69
|
-
# events_by_stream_and_group = {
|
70
|
-
# ['group','stream'] => [{timestamp => 1, message => "message1"},{timestamp => 2, message => "mesage2"}],
|
71
|
-
# ['group2','stream2'] => [{timestamp => 3, message => "message3"},{timestamp => 4, message => "message4"}]
|
72
|
-
# }
|
73
79
|
log_events = events_arr.sort_by { |event| event.timestamp.time.to_f}
|
74
80
|
log_events.each do |event|
|
75
81
|
event_log_stream_name = event.sprintf(log_stream_name)
|
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: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Klyba
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|