fluent-plugin-loki 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +8 -2
- data/fluent-plugin-loki.gemspec +1 -1
- data/lib/fluent/plugin/out_loki.rb +12 -2
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 81073839ffb94f94fca6fb985e7198c1fbd3c83cddbfb7be0e8ca9d84052608d
|
4
|
+
data.tar.gz: 953ebade1319eaa5e9916706682a3df9a4bb25d9a58da61fe16c5facf6f7ef07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1c97ce4da2402367629a304f05b56a491c411d20f47f0a7537c33019e0e4a1121c0a3e8f206d02e8347e159501ef00a75f2dc86a81e5c1cbc9941751d3776f3
|
7
|
+
data.tar.gz: ae319239ddea0888cc55281a9f0f0a74166eb7115a227b71266fddce05ee7c9d34f82f408751bfb537b3bc87c7abcd8df9d68c865dc204ed9671b50f8261ec26
|
data/README.md
CHANGED
@@ -5,13 +5,19 @@
|
|
5
5
|
- Can be used to ship docker logs to Loki (using [Fluentd docker logging driver](https://docs.docker.com/config/containers/logging/fluentd/))
|
6
6
|
- Enable easier transtion to Loki - an alternative to Loki's Promtail
|
7
7
|
|
8
|
-
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
### RubyGems
|
11
|
+
|
12
|
+
```
|
13
|
+
$ gem install fluent-plugin-loki
|
14
|
+
```
|
9
15
|
|
10
16
|
## Configuration
|
11
17
|
sample configuration:
|
12
18
|
```
|
13
19
|
<match *>
|
14
|
-
@type
|
20
|
+
@type loki
|
15
21
|
endpoint_url http://127.0.0.1:3100
|
16
22
|
labels {"env":"prod","farm":"a"} # default: nil
|
17
23
|
tenant abcd # default: nil
|
data/fluent-plugin-loki.gemspec
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'net/http'
|
2
2
|
require 'uri'
|
3
3
|
require 'yajl'
|
4
|
+
require 'json'
|
4
5
|
require 'fluent/plugin/output'
|
5
6
|
|
6
7
|
class Fluent::Plugin::LokiOutput < Fluent::Plugin::Output
|
@@ -47,6 +48,9 @@ class Fluent::Plugin::LokiOutput < Fluent::Plugin::Output
|
|
47
48
|
# Switch non-buffered/buffered plugin
|
48
49
|
config_param :buffered, :bool, :default => false
|
49
50
|
|
51
|
+
# Support multiple JSON encoders
|
52
|
+
config_param :encoder, :enum, list: [:yajl, :json], default: :yajl
|
53
|
+
|
50
54
|
config_section :buffer do
|
51
55
|
config_set_default :@type, DEFAULT_BUFFER_TYPE
|
52
56
|
config_set_default :chunk_keys, ['tag']
|
@@ -56,12 +60,18 @@ class Fluent::Plugin::LokiOutput < Fluent::Plugin::Output
|
|
56
60
|
compat_parameters_convert(conf, :buffer)
|
57
61
|
super
|
58
62
|
|
63
|
+
@encoder = case @encoder
|
64
|
+
when :yajl
|
65
|
+
Yajl
|
66
|
+
when :json
|
67
|
+
JSON
|
68
|
+
end
|
69
|
+
|
59
70
|
@ssl_verify_mode = if @ssl_no_verify
|
60
71
|
OpenSSL::SSL::VERIFY_NONE
|
61
72
|
else
|
62
73
|
OpenSSL::SSL::VERIFY_PEER
|
63
74
|
end
|
64
|
-
|
65
75
|
@ca_file = @cacert_file
|
66
76
|
@last_request_time = nil
|
67
77
|
raise Fluent::ConfigError, "'tag' in chunk_keys is required." if !@chunk_key_tag && @buffered
|
@@ -99,7 +109,7 @@ class Fluent::Plugin::LokiOutput < Fluent::Plugin::Output
|
|
99
109
|
end
|
100
110
|
|
101
111
|
def set_json_body(req, data)
|
102
|
-
req.body =
|
112
|
+
req.body = @encoder.dump(data)
|
103
113
|
req['Content-Type'] = 'application/json'
|
104
114
|
end
|
105
115
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-loki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edan Shahmoon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yajl-ruby
|
@@ -121,8 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
|
-
|
125
|
-
rubygems_version: 2.5.2.1
|
124
|
+
rubygems_version: 3.1.2
|
126
125
|
signing_key:
|
127
126
|
specification_version: 4
|
128
127
|
summary: A Fluentd output plugin to send logs to Grafana Loki
|