fluent-plugin-datadog_event 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/README.md +26 -20
- data/fluent-plugin-datadog_event.gemspec +2 -1
- data/lib/fluent/plugin/datadog_event/version.rb +1 -1
- data/lib/fluent/plugin/out_datadog_event.rb +49 -34
- metadata +24 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f76f717b87b37cb1549d64f4cc0dd8fe9ea8274f2124947234225cf34911fd91
|
4
|
+
data.tar.gz: 4b0833603c7d38958070156e96e2fbdd63b7daf3953b3aae2e79bfbb0d1390d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c2c3afda9716f3d6aa4ce5e17fe38cf809ffeb613c0e4a757ba2cff6c61a1b65cb31f1e9c867c41ccb33c32ee438b6b7d8809eb5d19a8a327ae745b6068be15
|
7
|
+
data.tar.gz: 5aa3b7647d5d40d15a4db80b01125217343a8f872ed9fd0d487080d0cef935f3548fca38bfdb48bbf3ad95139e67eca9a039b27e9f57927a8ae71906e5403c29
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -2,23 +2,11 @@
|
|
2
2
|
|
3
3
|
Generates Datadog events from matching fluent records.
|
4
4
|
|
5
|
-
## Installation
|
5
|
+
## Installation (from original source)
|
6
6
|
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
```ruby
|
10
|
-
gem 'fluent-plugin-datadog_event'
|
11
7
|
```
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
$ bundle
|
16
|
-
|
17
|
-
Or install it yourself as:
|
18
|
-
|
19
|
-
$ gem install fluent-plugin-datadog_event
|
20
|
-
|
21
|
-
(latter path depending upon acceptance)
|
8
|
+
$ gem install fluent-plugin-datadog_event
|
9
|
+
```
|
22
10
|
|
23
11
|
## Configuration
|
24
12
|
|
@@ -27,19 +15,29 @@ Or install it yourself as:
|
|
27
15
|
```
|
28
16
|
<match ddevents.info>
|
29
17
|
type datadog_event
|
18
|
+
|
30
19
|
# DD api key - mandatory
|
31
20
|
api_key MyApIKey110123kjla7
|
32
|
-
|
33
|
-
#
|
21
|
+
|
22
|
+
# All other config parameters are optional
|
23
|
+
|
24
|
+
# Datadog specific tags associated with event
|
34
25
|
tags fluentevent
|
26
|
+
|
35
27
|
# alert type: info, warning, error, or success
|
36
28
|
alert_type info
|
37
|
-
|
29
|
+
|
30
|
+
# aggregation key - anything with this unique value # will be considered an additional instance of the # same event
|
38
31
|
aggregation_key "my_aggregation_key"
|
39
|
-
|
32
|
+
|
33
|
+
# Message title
|
40
34
|
msg_title "My app event"
|
35
|
+
|
41
36
|
# Source name - for filtering by event source
|
42
37
|
source_type_name "my_app_named"
|
38
|
+
|
39
|
+
# Optional (or add it to record["host"])
|
40
|
+
host myhost
|
43
41
|
</match>
|
44
42
|
```
|
45
43
|
|
@@ -59,5 +57,13 @@ Tag values can be used for configuration, leading to a config style such as:
|
|
59
57
|
</match>
|
60
58
|
```
|
61
59
|
|
62
|
-
With the above config, an event tagged as 'ddevents.myapp.info' would be handled at the level of info, with "myapp" as part of the
|
60
|
+
With the above config, an event tagged as 'ddevents.myapp.info' would be handled at the level of info, with "myapp" as part of the message, source_type, and aggregation key - Use of rewrite-tag-names can make this very flexible.
|
61
|
+
|
62
|
+
|
63
|
+
## Contributing
|
63
64
|
|
65
|
+
1. Fork it ( https://github.com/inokappa/fluent-plugin-datadog_event )
|
66
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
67
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
68
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
69
|
+
5. Create a new Pull Request
|
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.9"
|
22
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
23
|
spec.add_runtime_dependency "dogapi"
|
24
|
-
spec.add_runtime_dependency "fluentd"
|
24
|
+
spec.add_runtime_dependency "fluentd", [">= 0.14.0", "< 2"]
|
25
25
|
spec.add_runtime_dependency "fluent-mixin-rewrite-tag-name"
|
26
|
+
spec.add_development_dependency "test-unit"
|
26
27
|
end
|
@@ -1,11 +1,16 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require 'fluent/plugin/output'
|
2
|
+
|
3
|
+
module Fluent::Plugin
|
4
|
+
class OutDatadogEvent < Output
|
3
5
|
Fluent::Plugin.register_output('datadog_event', self)
|
4
6
|
|
5
7
|
unless method_defined?(:log)
|
6
|
-
|
8
|
+
define_method("log") { $log }
|
7
9
|
end
|
8
10
|
|
11
|
+
helpers :compat_parameters
|
12
|
+
|
13
|
+
config_param :host, :string, :default => nil
|
9
14
|
config_param :api_key, :string
|
10
15
|
config_param :app_key, :string, :default => nil
|
11
16
|
config_param :msg_title, :string, :default => 'fluentd Datadog Event'
|
@@ -15,45 +20,55 @@ module Fluent
|
|
15
20
|
config_param :aggregation_key, :string, :default => nil
|
16
21
|
config_param :source_type_name, :string, :default => 'fluentd'
|
17
22
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
require "date"
|
23
|
+
config_section :buffer do
|
24
|
+
config_set_default :@type, "memory"
|
25
|
+
config_set_default :flush_mode, :immediate
|
26
|
+
config_set_default :chunk_keys, ["tag"]
|
23
27
|
end
|
24
28
|
|
25
|
-
def
|
26
|
-
|
27
|
-
|
29
|
+
def configure(conf)
|
30
|
+
super
|
31
|
+
|
32
|
+
compat_parameters_convert(conf, :buffer)
|
33
|
+
raise Fluent::ConfigError, "'tag' in chunk_keys is required." if not @chunk_key_tag
|
28
34
|
end
|
29
35
|
|
30
|
-
def
|
31
|
-
|
32
|
-
|
36
|
+
def initialize
|
37
|
+
super
|
38
|
+
|
39
|
+
require "dogapi"
|
40
|
+
require "date"
|
33
41
|
end
|
34
42
|
|
35
|
-
def
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
end
|
43
|
+
def start
|
44
|
+
super
|
45
|
+
|
46
|
+
@dog = Dogapi::Client.new(@api_key, @app_key)
|
40
47
|
end
|
41
48
|
|
42
|
-
def
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
:date_happend => time,
|
47
|
-
:priority => @priority,
|
48
|
-
# :host => @host,
|
49
|
-
:tags => @tags,
|
50
|
-
:alert_type => @alert_type,
|
51
|
-
:aggregation_key => @aggregation_key,
|
52
|
-
:source_type_name => @source_type_name
|
53
|
-
))
|
54
|
-
# for debug
|
55
|
-
#puts "debug_out: #{res}\n"
|
49
|
+
def write(chunk)
|
50
|
+
chunk.each do |time, record|
|
51
|
+
post_event(time, "record", record)
|
52
|
+
end
|
56
53
|
end
|
57
54
|
|
58
|
-
|
55
|
+
def post_event(time, event_key, record)
|
56
|
+
host = @host
|
57
|
+
if !host
|
58
|
+
host = record["host"]
|
59
|
+
end
|
60
|
+
|
61
|
+
res = @dog.emit_event(Dogapi::Event.new(
|
62
|
+
"#{record}",
|
63
|
+
:msg_title => @msg_title,
|
64
|
+
:date_happend => time,
|
65
|
+
:priority => @priority,
|
66
|
+
:host => host,
|
67
|
+
:tags => @tags,
|
68
|
+
:alert_type => @alert_type,
|
69
|
+
:aggregation_key => @aggregation_key,
|
70
|
+
:source_type_name => @source_type_name
|
71
|
+
))
|
72
|
+
end
|
73
|
+
end
|
59
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-datadog_event
|
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
|
- Yohei Kawahara(inokappa)
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,14 +58,20 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 0.14.0
|
62
|
+
- - "<"
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '2'
|
62
65
|
type: :runtime
|
63
66
|
prerelease: false
|
64
67
|
version_requirements: !ruby/object:Gem::Requirement
|
65
68
|
requirements:
|
66
69
|
- - ">="
|
67
70
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
71
|
+
version: 0.14.0
|
72
|
+
- - "<"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '2'
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
76
|
name: fluent-mixin-rewrite-tag-name
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +86,20 @@ dependencies:
|
|
80
86
|
- - ">="
|
81
87
|
- !ruby/object:Gem::Version
|
82
88
|
version: '0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: test-unit
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
83
103
|
description: fluentd plugin for datadog event
|
84
104
|
email:
|
85
105
|
- ''
|