fluent-plugin-influxdb 0.1.4 → 0.1.5
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/History.md +6 -0
- data/README.md +15 -2
- data/fluent-plugin-influxdb.gemspec +1 -1
- data/lib/fluent/plugin/out_influxdb.rb +14 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82755a9da4083b6a3332d70c9a507c3c673cacd8
|
4
|
+
data.tar.gz: 22f34a73363cf8ad51dab907e5ed3567b8f34e7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 467517fb2c36d325cdc2442472b33fc87541a6fb7af7fcd9ef5decadd25b5d28fb87223c58a56e33d1ec3e471f7fb8cfe42857c479a4af85a73ab8fdf94ca564
|
7
|
+
data.tar.gz: ced627914b119923edf46eed24a05b745435570a7ce2aae43f2aaee9e5124867db3724a6f6b515723e42e53afc4285113e715e27e5d25ae971ffad0b3e7030f5
|
data/History.md
CHANGED
data/README.md
CHANGED
@@ -29,14 +29,16 @@ Just like other regular output plugins, Use type `influxdb` in your fluentd conf
|
|
29
29
|
`password`: The password of the user, default to "root"
|
30
30
|
|
31
31
|
`use_ssl`: Use SSL when connecting to influxDB. default to false
|
32
|
-
|
32
|
+
|
33
33
|
`time_precision`: The time precision of timestamp. default to "s". should specify either second (s), millisecond (m), or microsecond (u)
|
34
34
|
|
35
|
+
### Fluentd Tag and InfluxDB Series
|
35
36
|
|
37
|
+
influxdb plugin uses Fluentd event tag for InfluxDB series.
|
38
|
+
So if you have events with `app.event`, influxdb plugin inserts events into `app.event` series in InfluxDB.
|
36
39
|
|
37
40
|
## Configuration Example
|
38
41
|
|
39
|
-
|
40
42
|
```
|
41
43
|
<match mylog.*>
|
42
44
|
type influxdb
|
@@ -69,6 +71,17 @@ The details of BufferedOutput is [here](http://docs.fluentd.org/articles/buffer-
|
|
69
71
|
|
70
72
|
---
|
71
73
|
|
74
|
+
fluentd-plugin-influxdb also includes the HandleTagNameMixin mixin which allows the following additional options:
|
75
|
+
|
76
|
+
```
|
77
|
+
remove_tag_prefix <tag_prefix_to_remove_including_the_dot>
|
78
|
+
remove_tag_suffix <tag_suffix_to_remove_including_the_dot>
|
79
|
+
add_tag_prefix <tag_prefix_to_add_including_the_dot>
|
80
|
+
add_tag_suffix <tag_suffix_to_add_including_the_dot>
|
81
|
+
```
|
82
|
+
|
83
|
+
---
|
84
|
+
|
72
85
|
Also please consider using [fluent-plugin-multiprocess](https://github.com/frsyuki/fluent-plugin-multiprocess) to fork multiple threads for your metrics:
|
73
86
|
|
74
87
|
## Contributing
|
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "fluent-plugin-influxdb"
|
6
|
-
s.version = '0.1.
|
6
|
+
s.version = '0.1.5'
|
7
7
|
s.authors = ["Masahiro Nakagawa", "FangLi"]
|
8
8
|
s.email = ["repeatedly@gmail.com", "surivlee@gmail.com"]
|
9
9
|
s.description = %q{InfluxDB output plugin for Fluentd}
|
@@ -1,10 +1,13 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
require 'date'
|
3
3
|
require 'influxdb'
|
4
|
+
require 'fluent/mixin/mixin'
|
4
5
|
|
5
6
|
class Fluent::InfluxdbOutput < Fluent::BufferedOutput
|
6
7
|
Fluent::Plugin.register_output('influxdb', self)
|
7
8
|
|
9
|
+
include Fluent::HandleTagNameMixin
|
10
|
+
|
8
11
|
config_param :host, :string, :default => 'localhost'
|
9
12
|
config_param :port, :integer, :default => 8086
|
10
13
|
config_param :dbname, :string, :default => 'fluentd'
|
@@ -20,14 +23,13 @@ class Fluent::InfluxdbOutput < Fluent::BufferedOutput
|
|
20
23
|
|
21
24
|
def configure(conf)
|
22
25
|
super
|
23
|
-
@influxdb = InfluxDB::Client.new @dbname, host: @host,
|
24
|
-
port: @port,
|
25
|
-
username: @user,
|
26
|
+
@influxdb = InfluxDB::Client.new @dbname, host: @host,
|
27
|
+
port: @port,
|
28
|
+
username: @user,
|
26
29
|
password: @password,
|
27
30
|
async: false,
|
28
31
|
time_precision: @time_precision,
|
29
32
|
use_ssl: @use_ssl
|
30
|
-
|
31
33
|
end
|
32
34
|
|
33
35
|
def start
|
@@ -35,6 +37,7 @@ class Fluent::InfluxdbOutput < Fluent::BufferedOutput
|
|
35
37
|
end
|
36
38
|
|
37
39
|
def format(tag, time, record)
|
40
|
+
# TODO: Use tag based chunk separation for more reliability
|
38
41
|
[tag, time, record].to_msgpack
|
39
42
|
end
|
40
43
|
|
@@ -43,11 +46,17 @@ class Fluent::InfluxdbOutput < Fluent::BufferedOutput
|
|
43
46
|
end
|
44
47
|
|
45
48
|
def write(chunk)
|
49
|
+
points = {}
|
46
50
|
chunk.msgpack_each do |tag, time, record|
|
47
51
|
unless record.empty?
|
48
52
|
record[:time] = time
|
49
|
-
|
53
|
+
points[tag] ||= []
|
54
|
+
points[tag] << record
|
50
55
|
end
|
51
56
|
end
|
57
|
+
|
58
|
+
points.each { |tag, records|
|
59
|
+
@influxdb.write_point(tag, records)
|
60
|
+
}
|
52
61
|
end
|
53
62
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-influxdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masahiro Nakagawa
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-05-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|