fluent-plugin-logtail 0.2.0 → 0.2.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 +4 -4
- data/README.md +13 -22
- data/fluent-plugin-logtail.gemspec +1 -1
- data/lib/fluent/plugin/out_logtail.rb +4 -3
- data/spec/fluent/plugin/out_logtail_spec.rb +41 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 812d8fea53a6dc3b81c07be27f454c178d9ff2ce9bc4d6bde6531dc12e92c0c4
|
4
|
+
data.tar.gz: 61a02d757f5e7623e5d556c3f0ab383942a640065857f745b4814771839de1fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 615922ba184a54c595633a6c8ef0c99db5f4e2ebf4814e41c4b80315221063cf6a997ca31bc94df34cd2d0bdbcf400dc07b2d9d054df098b1867515569026eeb
|
7
|
+
data.tar.gz: 42a5b851381bd677dd2ce65a823b85e6ca9624c7631ee65a4ce05f52fd8a32939fa20c0589f33c1f84d8227c17b959d0e0c48994b03cc1d662ad1e6de227f6d1
|
data/README.md
CHANGED
@@ -1,31 +1,22 @@
|
|
1
|
-
#
|
1
|
+
# [Better Stack](https://betterstack.com/logs) Fluentd plugin
|
2
2
|
|
3
|
-
[
|
3
|
+
📣 Logtail is now part of Better Stack. [Learn more ⇗](https://betterstack.com/press/introducing-better-stack/)
|
4
4
|
|
5
|
-
|
5
|
+
[](https://betterstack.com/logs)
|
6
6
|
|
7
|
-
|
7
|
+
[](LICENSE.md)
|
8
|
+
[](https://badge.fury.io/rb/fluent-plugin-logtail)
|
9
|
+
[](https://github.com/logtail/fluentd-plugin-logtail/actions/workflows/main.yml)
|
8
10
|
|
9
|
-
|
10
|
-
gem install fluent-plugin-logtail
|
11
|
-
```
|
11
|
+
Experience SQL-compatible structured log management based on ClickHouse. [Learn more ⇗](https://betterstack.com/logs)
|
12
12
|
|
13
|
-
##
|
13
|
+
## Documentation
|
14
14
|
|
15
|
-
|
15
|
+
[Getting started ⇗](https://betterstack.com/docs/logs/fluentd/)
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
@type logtail
|
20
|
-
source_token YOUR_SOURCE_TOKEN
|
21
|
-
# ip 127.0.0.1
|
22
|
-
buffer_chunk_limit 1m # Must be < 5m
|
23
|
-
flush_at_shutdown true # Only needed with file buffer
|
24
|
-
</match>
|
25
|
-
```
|
17
|
+
## Need help?
|
18
|
+
Please let us know at [hello@betterstack.com](mailto:hello@betterstack.com). We're happy to help!
|
26
19
|
|
27
|
-
|
20
|
+
---
|
28
21
|
|
29
|
-
|
30
|
-
|
31
|
-
For advanced configuration options, please see to the [buffered output parameters documentation.](http://docs.fluentd.org/articles/output-plugin-overview#buffered-output-parameters).
|
22
|
+
[ISC license](https://github.com/logtail/fluentd-plugin-logtail/blob/main/LICENSE.md)
|
@@ -3,7 +3,7 @@ require 'date'
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'fluent-plugin-logtail'
|
6
|
-
s.version = '0.2.
|
6
|
+
s.version = '0.2.1'
|
7
7
|
s.date = Date.today.to_s
|
8
8
|
s.summary = 'Logtail.com plugin for Fluentd'
|
9
9
|
s.description = 'Streams Fluentd logs to the Logtail.com logging service.'
|
@@ -5,9 +5,8 @@ module Fluent
|
|
5
5
|
class LogtailOutput < Fluent::BufferedOutput
|
6
6
|
Fluent::Plugin.register_output('logtail', self)
|
7
7
|
|
8
|
-
VERSION = "0.
|
8
|
+
VERSION = "0.1.1".freeze
|
9
9
|
CONTENT_TYPE = "application/msgpack".freeze
|
10
|
-
HOST = "in.logtail.com".freeze
|
11
10
|
PORT = 443
|
12
11
|
PATH = "/".freeze
|
13
12
|
MAX_ATTEMPTS = 3.freeze
|
@@ -16,9 +15,11 @@ module Fluent
|
|
16
15
|
|
17
16
|
config_param :source_token, :string, secret: true
|
18
17
|
config_param :ip, :string, default: nil
|
18
|
+
config_param :ingesting_host, :string, default: "in.logs.betterstack.com"
|
19
19
|
|
20
20
|
def configure(conf)
|
21
21
|
@source_token = conf["source_token"]
|
22
|
+
@ingesting_host = conf["ingesting_host"]
|
22
23
|
super
|
23
24
|
end
|
24
25
|
|
@@ -90,7 +91,7 @@ module Fluent
|
|
90
91
|
end
|
91
92
|
|
92
93
|
def build_http_client
|
93
|
-
http = Net::HTTP.new(
|
94
|
+
http = Net::HTTP.new(@ingesting_host, PORT)
|
94
95
|
http.use_ssl = true
|
95
96
|
# Verification on Windows fails despite having a valid certificate.
|
96
97
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
@@ -8,6 +8,13 @@ describe Fluent::LogtailOutput do
|
|
8
8
|
}
|
9
9
|
end
|
10
10
|
|
11
|
+
let(:cloud_config) do
|
12
|
+
%{
|
13
|
+
source_token abcd1234
|
14
|
+
ingesting_host s1234.eu-nbg-2.betterstackdata.com
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
11
18
|
let(:driver) do
|
12
19
|
tag = "test"
|
13
20
|
Fluent::Test::BufferedOutputTestDriver.new(Fluent::LogtailOutput, tag) {
|
@@ -19,6 +26,19 @@ describe Fluent::LogtailOutput do
|
|
19
26
|
end
|
20
27
|
}.configure(config)
|
21
28
|
end
|
29
|
+
|
30
|
+
let(:cloud_driver) do
|
31
|
+
tag = "test"
|
32
|
+
Fluent::Test::BufferedOutputTestDriver.new(Fluent::LogtailOutput, tag) {
|
33
|
+
# v0.12's test driver assume format definition. This simulates ObjectBufferedOutput format
|
34
|
+
if !defined?(Fluent::Plugin::Output)
|
35
|
+
def format(tag, time, record)
|
36
|
+
[time, record].to_msgpack
|
37
|
+
end
|
38
|
+
end
|
39
|
+
}.configure(cloud_config)
|
40
|
+
end
|
41
|
+
|
22
42
|
let(:record) do
|
23
43
|
{'age' => 26, 'request_id' => '42', 'parent_id' => 'parent', 'routing_id' => 'routing'}
|
24
44
|
end
|
@@ -28,11 +48,11 @@ describe Fluent::LogtailOutput do
|
|
28
48
|
end
|
29
49
|
|
30
50
|
describe "#write" do
|
31
|
-
it "should send a chunked request to the Logtail API" do
|
32
|
-
stub = stub_request(:post, "https://in.
|
51
|
+
it "should send a chunked request to the Logtail API using default host" do
|
52
|
+
stub = stub_request(:post, "https://in.logs.betterstack.com/").
|
33
53
|
with(
|
34
54
|
:body => start_with("\xDD\x00\x00\x00\x01\x85\xA3age\x1A\xAArequest_id\xA242\xA9parent_id\xA6parent\xAArouting_id\xA7routing\xA2dt\xB4".force_encoding("ASCII-8BIT")),
|
35
|
-
:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer abcd1234', 'Content-Type'=>'application/msgpack', 'User-Agent'=>'Logtail Fluentd/0.
|
55
|
+
:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer abcd1234', 'Content-Type'=>'application/msgpack', 'User-Agent'=>'Logtail Fluentd/0.1.1'}
|
36
56
|
).
|
37
57
|
to_return(:status => 202, :body => "", :headers => {})
|
38
58
|
|
@@ -43,7 +63,7 @@ describe Fluent::LogtailOutput do
|
|
43
63
|
end
|
44
64
|
|
45
65
|
it "handles 500s" do
|
46
|
-
stub = stub_request(:post, "https://in.
|
66
|
+
stub = stub_request(:post, "https://in.logs.betterstack.com/").to_return(:status => 500, :body => "", :headers => {})
|
47
67
|
|
48
68
|
driver.emit(record)
|
49
69
|
driver.run
|
@@ -52,7 +72,7 @@ describe Fluent::LogtailOutput do
|
|
52
72
|
end
|
53
73
|
|
54
74
|
it "handle auth failures" do
|
55
|
-
stub = stub_request(:post, "https://in.
|
75
|
+
stub = stub_request(:post, "https://in.logs.betterstack.com/").to_return(:status => 403, :body => "", :headers => {})
|
56
76
|
|
57
77
|
driver.emit(record)
|
58
78
|
driver.run
|
@@ -60,4 +80,20 @@ describe Fluent::LogtailOutput do
|
|
60
80
|
expect(stub).to have_been_requested.times(1)
|
61
81
|
end
|
62
82
|
end
|
83
|
+
|
84
|
+
describe "#write to cloud" do
|
85
|
+
it "should send a chunked request to the Logtail API" do
|
86
|
+
stub = stub_request(:post, "https://s1234.eu-nbg-2.betterstackdata.com/").
|
87
|
+
with(
|
88
|
+
:body => start_with("\xDD\x00\x00\x00\x01\x85\xA3age\x1A\xAArequest_id\xA242\xA9parent_id\xA6parent\xAArouting_id\xA7routing\xA2dt\xB4".force_encoding("ASCII-8BIT")),
|
89
|
+
:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer abcd1234', 'Content-Type'=>'application/msgpack', 'User-Agent'=>'Logtail Fluentd/0.1.1'}
|
90
|
+
).
|
91
|
+
to_return(:status => 202, :body => "", :headers => {})
|
92
|
+
|
93
|
+
cloud_driver.emit(record)
|
94
|
+
cloud_driver.run
|
95
|
+
|
96
|
+
expect(stub).to have_been_requested.times(1)
|
97
|
+
end
|
98
|
+
end
|
63
99
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-logtail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Logtail.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
- !ruby/object:Gem::Version
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
|
-
rubygems_version: 3.3.
|
109
|
+
rubygems_version: 3.3.7
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: Logtail.com plugin for Fluentd
|