fluent-plugin-grafana-loki 1.2.12 → 1.2.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -10
- data/lib/fluent/plugin/out_loki.rb +13 -2
- metadata +52 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fd9308b0afb758b4718b7ad46fc5a3c154400a93514ea79fe3453279abe5cdc
|
4
|
+
data.tar.gz: b67621f7aa29c775f6e81f546623dec74d326097071f2ce5bd04523ffd865769
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e6fee1480cdd594f027cbbb22e503a7ecc0dd2384a6b5d46083eed2a6cdbb820d3c3bfe8f98f2cd197d89cbee2876d8a6659d57a070980b609e6b0cc99fec7a
|
7
|
+
data.tar.gz: 5452556eed1158c3ccaf5bcb5509a773ff89ad4f64e7b3e778603aef0d221cbd2d1ea5ff0e7bed47b1d68b51abae9bf58fccab5996b9ca67bcbfaf81a977cafe
|
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
#
|
1
|
+
# Fluentd output plugin
|
2
2
|
|
3
3
|
[Fluentd](https://fluentd.org/) is a data collector for unified logging layer, it can be configured with the Loki output plugin, provided in this folder, to ship logs to Loki.
|
4
4
|
|
5
|
-
See [docs/client/fluentd/README.md](../../docs/clients/fluentd/
|
5
|
+
See [docs/client/fluentd/README.md](../../docs/sources/clients/fluentd/_index.md) for detailed information.
|
6
6
|
|
7
7
|
## Development
|
8
8
|
|
9
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
9
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
10
10
|
|
11
11
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `fluent-plugin-grafana-loki.gemspec`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
12
12
|
|
@@ -18,17 +18,21 @@ Useful additions:
|
|
18
18
|
## Testing
|
19
19
|
|
20
20
|
Start Loki using:
|
21
|
-
|
21
|
+
|
22
|
+
```bash
|
22
23
|
docker run -it -p 3100:3100 grafana/loki:latest
|
23
24
|
```
|
24
25
|
|
25
26
|
Verify that Loki accept and stores logs:
|
26
|
-
|
27
|
+
|
28
|
+
```bash
|
27
29
|
curl -H "Content-Type: application/json" -XPOST -s "http://localhost:3100/loki/api/v1/push" --data-raw "{\"streams\": [{\"stream\": {\"job\": \"test\"}, \"values\": [[\"$(date +%s)000000000\", \"fizzbuzz\"]]}]}"
|
28
30
|
curl "http://localhost:3100/loki/api/v1/query_range" --data-urlencode 'query={job="test"}' --data-urlencode 'step=300' | jq .data.result
|
29
31
|
```
|
32
|
+
|
30
33
|
The expected output is:
|
31
|
-
|
34
|
+
|
35
|
+
```json
|
32
36
|
[
|
33
37
|
{
|
34
38
|
"stream": {
|
@@ -44,17 +48,21 @@ The expected output is:
|
|
44
48
|
]
|
45
49
|
```
|
46
50
|
|
47
|
-
Start
|
48
|
-
|
51
|
+
Start and send test logs with Fluentd using:
|
52
|
+
|
53
|
+
```bash
|
49
54
|
LOKI_URL=http://{{ IP }}:3100 make fluentd-test
|
50
55
|
```
|
51
56
|
|
52
57
|
Verify that syslogs are being feeded into Loki:
|
53
|
-
|
58
|
+
|
59
|
+
```bash
|
54
60
|
curl "http://localhost:3100/loki/api/v1/query_range" --data-urlencode 'query={job="fluentd"}' --data-urlencode 'step=300' | jq .data.result
|
55
61
|
```
|
62
|
+
|
56
63
|
The expected output is:
|
57
|
-
|
64
|
+
|
65
|
+
```json
|
58
66
|
[
|
59
67
|
{
|
60
68
|
"stream": {
|
@@ -36,7 +36,7 @@ module Fluent
|
|
36
36
|
DEFAULT_BUFFER_TYPE = 'memory'
|
37
37
|
|
38
38
|
desc 'url of loki server'
|
39
|
-
config_param :url, :string, default: 'https://logs-us-
|
39
|
+
config_param :url, :string, default: 'https://logs-prod-us-central1.grafana.net'
|
40
40
|
|
41
41
|
desc 'BasicAuth credentials'
|
42
42
|
config_param :username, :string, default: nil
|
@@ -49,6 +49,9 @@ module Fluent
|
|
49
49
|
desc 'TLS'
|
50
50
|
config_param :ca_cert, :string, default: nil
|
51
51
|
|
52
|
+
desc 'Disable server certificate verification'
|
53
|
+
config_param :insecure_tls, :bool, default: false
|
54
|
+
|
52
55
|
desc 'Loki tenant id'
|
53
56
|
config_param :tenant, :string, default: nil
|
54
57
|
|
@@ -153,14 +156,22 @@ module Fluent
|
|
153
156
|
use_ssl: uri.scheme == 'https'
|
154
157
|
}
|
155
158
|
|
159
|
+
# Disable server TLS certificate verification
|
160
|
+
if @insecure_tls
|
161
|
+
opts = opts.merge(
|
162
|
+
verify_mode: OpenSSL::SSL::VERIFY_NONE
|
163
|
+
)
|
164
|
+
end
|
165
|
+
|
166
|
+
# Verify client TLS certificate
|
156
167
|
if !@cert.nil? && !@key.nil?
|
157
168
|
opts = opts.merge(
|
158
|
-
verify_mode: OpenSSL::SSL::VERIFY_PEER,
|
159
169
|
cert: @cert,
|
160
170
|
key: @key
|
161
171
|
)
|
162
172
|
end
|
163
173
|
|
174
|
+
# Specify custom certificate authority
|
164
175
|
unless @ca_cert.nil?
|
165
176
|
opts = opts.merge(
|
166
177
|
ca_file: @ca_cert
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-grafana-loki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- woodsaj
|
@@ -10,8 +10,28 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-
|
13
|
+
date: 2020-07-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: fluentd
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.9.3
|
22
|
+
- - "<"
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '2'
|
25
|
+
type: :runtime
|
26
|
+
prerelease: false
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 1.9.3
|
32
|
+
- - "<"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '2'
|
15
35
|
- !ruby/object:Gem::Dependency
|
16
36
|
name: bundler
|
17
37
|
requirement: !ruby/object:Gem::Requirement
|
@@ -55,25 +75,47 @@ dependencies:
|
|
55
75
|
- !ruby/object:Gem::Version
|
56
76
|
version: '3.0'
|
57
77
|
- !ruby/object:Gem::Dependency
|
58
|
-
name:
|
78
|
+
name: rubocop-rspec
|
59
79
|
requirement: !ruby/object:Gem::Requirement
|
60
80
|
requirements:
|
61
81
|
- - ">="
|
62
82
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
64
|
-
|
83
|
+
version: '0'
|
84
|
+
type: :development
|
85
|
+
prerelease: false
|
86
|
+
version_requirements: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
65
89
|
- !ruby/object:Gem::Version
|
66
|
-
version: '
|
67
|
-
|
90
|
+
version: '0'
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: simplecov
|
93
|
+
requirement: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
type: :development
|
68
99
|
prerelease: false
|
69
100
|
version_requirements: !ruby/object:Gem::Requirement
|
70
101
|
requirements:
|
71
102
|
- - ">="
|
72
103
|
- !ruby/object:Gem::Version
|
73
|
-
version:
|
74
|
-
|
104
|
+
version: '0'
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
name: test-unit
|
107
|
+
requirement: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
75
110
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
111
|
+
version: '0'
|
112
|
+
type: :development
|
113
|
+
prerelease: false
|
114
|
+
version_requirements: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
77
119
|
description: Output plugin to ship logs to a Grafana Loki server
|
78
120
|
email:
|
79
121
|
- awoods@grafana.com
|