fluent-plugin-grafana-loki 1.1.1 → 1.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 +16 -0
- data/lib/fluent/plugin/out_loki.rb +33 -0
- 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: 500a298bd9861429eb29eae445bdaf02f1d8802bcd554e107e9f9c69c9d722f9
|
4
|
+
data.tar.gz: cb1ea3ee1ad170544e32819e654916370fc7e80b8197c51fb5efd32877a257f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d3bfc2e5121fd39744099572fb25761842f9039c23e5229b275ae2ecb4179c3157b2367b6edb80b7e3e29606d724b6e1ee562aad8198ade75d5342cd8ffc23f
|
7
|
+
data.tar.gz: 630c02f220ac15861caf3f34dbbc4a5721c96980dbc51bce5dd9bc7dfef93a4a6461640937bcb34cca9028a83220b3e4359fa0173371955f2b06e5ce8fe27295
|
data/README.md
CHANGED
@@ -166,6 +166,22 @@ If using the GrafanaLab's hosted Loki, the username needs to be set to your inst
|
|
166
166
|
### tenant
|
167
167
|
Loki is a multi-tenant log storage platform and all requests sent must include a tenant. For some installations the tenant will be set automatically by an authenticating proxy. Otherwise you can define a tenant to be passed through. The tenant can be any string value.
|
168
168
|
|
169
|
+
### client certificate verification
|
170
|
+
Specify a pair of client certificate and private key with `cert` and `key` if a reverse proxy with client certificate verification is configured in front of Loki. `ca_cert` can also be specified if the server uses custom certificate authority.
|
171
|
+
|
172
|
+
```
|
173
|
+
<match **>
|
174
|
+
@type loki
|
175
|
+
|
176
|
+
url "https://loki"
|
177
|
+
|
178
|
+
cert /path/to/certificate.pem
|
179
|
+
key /path/to/key.key
|
180
|
+
ca_cert /path/to/ca.pem
|
181
|
+
|
182
|
+
...
|
183
|
+
</match>
|
184
|
+
```
|
169
185
|
|
170
186
|
### output format
|
171
187
|
Loki is intended to index and group log streams using only a small set of labels. It is not intended for full-text indexing. When sending logs to Loki the majority of log message will be sent as a single log "line".
|
@@ -40,6 +40,13 @@ module Fluent
|
|
40
40
|
config_param :username, :string, default: nil
|
41
41
|
config_param :password, :string, default: nil, secret: true
|
42
42
|
|
43
|
+
desc 'Client certificate'
|
44
|
+
config_param :cert, :string, default: nil
|
45
|
+
config_param :key, :string, default: nil
|
46
|
+
|
47
|
+
desc 'TLS'
|
48
|
+
config_param :ca_cert, :string, default: nil
|
49
|
+
|
43
50
|
desc 'Loki tenant id'
|
44
51
|
config_param :tenant, :string, default: nil
|
45
52
|
|
@@ -78,6 +85,17 @@ module Fluent
|
|
78
85
|
@remove_keys.each do |key|
|
79
86
|
@remove_keys_accessors.push(record_accessor_create(key))
|
80
87
|
end
|
88
|
+
|
89
|
+
@cert = OpenSSL::X509::Certificate.new(File.read(@cert)) if @cert
|
90
|
+
@key = OpenSSL::PKey.read(File.read(key)) if @key
|
91
|
+
|
92
|
+
if !@key.is_a?(OpenSSL::PKey::RSA) && !@key.is_a?(OpenSSL::PKey::DSA)
|
93
|
+
raise "Unsupported private key type #{key.class}"
|
94
|
+
end
|
95
|
+
|
96
|
+
if !@ca_cert.nil? && !File.exist?(@ca_cert)
|
97
|
+
raise "CA certificate file #{@ca_cert} not found"
|
98
|
+
end
|
81
99
|
end
|
82
100
|
|
83
101
|
def multi_workers_ready?
|
@@ -110,6 +128,21 @@ module Fluent
|
|
110
128
|
opts = {
|
111
129
|
use_ssl: uri.scheme == 'https'
|
112
130
|
}
|
131
|
+
|
132
|
+
if !@cert.nil? && !@key.nil?
|
133
|
+
opts = opts.merge(
|
134
|
+
verify_mode: OpenSSL::SSL::VERIFY_PEER,
|
135
|
+
cert: @cert,
|
136
|
+
key: @key
|
137
|
+
)
|
138
|
+
end
|
139
|
+
|
140
|
+
if !@ca_cert.nil?
|
141
|
+
opts = opts.merge(
|
142
|
+
ca_file: @ca_cert
|
143
|
+
)
|
144
|
+
end
|
145
|
+
|
113
146
|
log.debug "sending #{req.body.length} bytes to loki"
|
114
147
|
res = Net::HTTP.start(uri.hostname, uri.port, **opts) { |http| http.request(req) }
|
115
148
|
unless res&.is_a?(Net::HTTPSuccess)
|
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.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- woodsaj
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-11-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|