fluent-plugin-cloudwatch-logs 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3445e1c11e8856669ee57b3557865f0f4944699dd49a93c61e518c3cbe88de9b
|
4
|
+
data.tar.gz: 43453d4dd9eefed4805541de0e69f0715e2caf9d451c705c5ab403a77f85473b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fa3558069bba0d7d9ffe98d61357eef71fd05648c5eaedc614fe0b5a0ced11d8a8fb2bb34a43b4dcab7990bcfd07f4540406334a46293b75be84b2c5986af54
|
7
|
+
data.tar.gz: 7e1a3196f98975d0f9a24d0f14b3a49f14e603eefc76533384fe4bc5bec4547ef9e78d8690ea99c282e04ba861c8ca243684da3ee5ffaa12645f6aa59fe1c670
|
@@ -0,0 +1,12 @@
|
|
1
|
+
name: Autocloser
|
2
|
+
on: [issues]
|
3
|
+
jobs:
|
4
|
+
autoclose:
|
5
|
+
runs-on: ubuntu-latest
|
6
|
+
steps:
|
7
|
+
- name: Autoclose issues that did not follow issue template
|
8
|
+
uses: roots/issue-closer-action@v1.1
|
9
|
+
with:
|
10
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
11
|
+
issue-close-message: "@${issue.user.login} this issue was automatically closed because it did not follow the issue template."
|
12
|
+
issue-pattern: "(.*Problem.*)|(.*Expected Behavior or What you need to ask.*)|(.*Using Fluentd and CloudWatchLogs plugin versions.*)"
|
data/README.md
CHANGED
@@ -43,6 +43,46 @@ Create IAM user with a policy like the following:
|
|
43
43
|
}
|
44
44
|
```
|
45
45
|
|
46
|
+
More restricted IAM policy for `out_cloudwatch_logs` is:
|
47
|
+
|
48
|
+
```json
|
49
|
+
{
|
50
|
+
"Version": "2012-10-17",
|
51
|
+
"Statement": [
|
52
|
+
{
|
53
|
+
"Action": [
|
54
|
+
"logs:PutLogEvents",
|
55
|
+
"logs:CreateLogGroup",
|
56
|
+
"logs:PutRetentionPolicy",
|
57
|
+
"logs:CreateLogStream",
|
58
|
+
"logs:DescribeLogGroups",
|
59
|
+
"logs:DescribeLogStreams"
|
60
|
+
],
|
61
|
+
"Effect": "Allow",
|
62
|
+
"Resource": "*"
|
63
|
+
}
|
64
|
+
]
|
65
|
+
}
|
66
|
+
```
|
67
|
+
|
68
|
+
Also, more restricted IAM policy for `in_cloudwatch_logs` is:
|
69
|
+
|
70
|
+
```json
|
71
|
+
{
|
72
|
+
"Version": "2012-10-17",
|
73
|
+
"Statement": [
|
74
|
+
{
|
75
|
+
"Action": [
|
76
|
+
"logs:GetLogEvents",
|
77
|
+
"logs:DescribeLogStreams"
|
78
|
+
],
|
79
|
+
"Effect": "Allow",
|
80
|
+
"Resource": "*"
|
81
|
+
}
|
82
|
+
]
|
83
|
+
}
|
84
|
+
```
|
85
|
+
|
46
86
|
## Authentication
|
47
87
|
|
48
88
|
There are several methods to provide authentication credentials. Be aware that there are various tradeoffs for these methods,
|
@@ -7,6 +7,8 @@ module Fluent::Plugin
|
|
7
7
|
class CloudwatchLogsOutput < Output
|
8
8
|
Fluent::Plugin.register_output('cloudwatch_logs', self)
|
9
9
|
|
10
|
+
class TooLargeEventError < Fluent::UnrecoverableError; end
|
11
|
+
|
10
12
|
helpers :compat_parameters, :inject
|
11
13
|
|
12
14
|
DEFAULT_BUFFER_TYPE = "memory"
|
@@ -319,8 +321,7 @@ module Fluent::Plugin
|
|
319
321
|
while event = events.shift
|
320
322
|
event_bytesize = event[:message].bytesize + EVENT_HEADER_SIZE
|
321
323
|
if MAX_EVENT_SIZE < event_bytesize
|
322
|
-
|
323
|
-
break
|
324
|
+
raise TooLargeEventError, "Log event in #{group_name} is discarded because it is too large: #{event_bytesize} bytes exceeds limit of #{MAX_EVENT_SIZE}"
|
324
325
|
end
|
325
326
|
|
326
327
|
new_chunk = chunk + [event]
|
@@ -399,7 +400,13 @@ module Fluent::Plugin
|
|
399
400
|
raise err
|
400
401
|
end
|
401
402
|
rescue Aws::CloudWatchLogs::Errors::ThrottlingException => err
|
402
|
-
if
|
403
|
+
if @put_log_events_retry_limit < 1
|
404
|
+
log.warn "failed to PutLogEvents and discard logs because put_log_events_retry_limit is less than 1", {
|
405
|
+
"error_class" => err.class.to_s,
|
406
|
+
"error" => err.message,
|
407
|
+
}
|
408
|
+
return
|
409
|
+
elsif !@put_log_events_disable_retry_limit && @put_log_events_retry_limit < retry_count
|
403
410
|
log.error "failed to PutLogEvents and discard logs because retry count exceeded put_log_events_retry_limit", {
|
404
411
|
"error_class" => err.class.to_s,
|
405
412
|
"error" => err.message,
|
@@ -713,6 +713,32 @@ class CloudwatchLogsOutputTest < Test::Unit::TestCase
|
|
713
713
|
assert_equal({'cloudwatch' => 'logs2', 'message' => 'message2'}, JSON.parse(events[1].message))
|
714
714
|
end
|
715
715
|
|
716
|
+
def test_retrying_on_throttling_exception_with_put_log_events_retry_limit_as_zero
|
717
|
+
client = Aws::CloudWatchLogs::Client.new
|
718
|
+
@called = false
|
719
|
+
stub(client).put_log_events(anything) {
|
720
|
+
raise(Aws::CloudWatchLogs::Errors::ThrottlingException.new(nil, "error"))
|
721
|
+
}.once.ordered
|
722
|
+
|
723
|
+
d = create_driver(<<-EOC)
|
724
|
+
#{default_config}
|
725
|
+
log_group_name #{log_group_name}
|
726
|
+
log_stream_name #{log_stream_name}
|
727
|
+
@log_level debug
|
728
|
+
put_log_events_retry_limit 0
|
729
|
+
EOC
|
730
|
+
time = event_time
|
731
|
+
d.instance.instance_variable_set(:@logs, client)
|
732
|
+
d.run(default_tag: fluentd_tag) do
|
733
|
+
d.feed(time, {'message' => 'message1'})
|
734
|
+
end
|
735
|
+
|
736
|
+
logs = d.logs
|
737
|
+
assert_equal(0, logs.select {|l| l =~ /Called PutLogEvents API/ }.size)
|
738
|
+
assert_equal(1, logs.select {|l| l =~ /failed to PutLogEvents/ }.size)
|
739
|
+
assert_equal(0, logs.select {|l| l =~ /retry succeeded/ }.size)
|
740
|
+
end
|
741
|
+
|
716
742
|
def test_retrying_on_throttling_exception
|
717
743
|
resp = Object.new
|
718
744
|
mock(resp).rejected_log_events_info {}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-cloudwatch-logs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryota Arai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -115,6 +115,7 @@ executables: []
|
|
115
115
|
extensions: []
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
|
+
- ".github/workflows/issue-auto-closer.yml"
|
118
119
|
- ".gitignore"
|
119
120
|
- ".travis.yml"
|
120
121
|
- Gemfile
|