fluent-plugin-logdna 0.3.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7dc5c3a579927d59c9a9705bd5ceec17d5a6dc3d8964d1639dd51afb23eaca80
4
+ data.tar.gz: 2519afb42481d5840bd11b5d579637e4ea55008dc89996421013185d76439374
5
+ SHA512:
6
+ metadata.gz: 511d77f656a7584723954052a7f4c0e70b39f8115f88cbfff2369b1d9e7388fac35242ff9b52a5e0b6b2292e73c757a3efb1025833bfd6b9a96dd9ef1437fad5
7
+ data.tar.gz: c1058ffb07ab69ad383c3b1d8015aaf912ebe3d0632c612c6e63d2ba41b75c6b930fa03f8f4a415c066501bbf4ab38f900f8728b9d630cf41bee002f5b8f6b2c
@@ -0,0 +1,52 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
51
+
52
+ .DS_Store
@@ -0,0 +1 @@
1
+ 2.3.1
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem "rake", "~> 12.3"
6
+ gem "webmock"
@@ -0,0 +1,70 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ fluent-plugin-logdna (0.3.1)
5
+ fluentd (>= 0.12.0, < 2)
6
+ http (~> 2.0, >= 2.0.3)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.7.0)
12
+ public_suffix (>= 2.0.2, < 5.0)
13
+ concurrent-ruby (1.1.6)
14
+ cool.io (1.6.0)
15
+ crack (0.4.3)
16
+ safe_yaml (~> 1.0.0)
17
+ domain_name (0.5.20190701)
18
+ unf (>= 0.0.5, < 1.0.0)
19
+ fluentd (1.11.1)
20
+ cool.io (>= 1.4.5, < 2.0.0)
21
+ http_parser.rb (>= 0.5.1, < 0.7.0)
22
+ msgpack (>= 1.3.1, < 2.0.0)
23
+ serverengine (>= 2.0.4, < 3.0.0)
24
+ sigdump (~> 0.2.2)
25
+ strptime (>= 0.2.2, < 1.0.0)
26
+ tzinfo (>= 1.0, < 3.0)
27
+ tzinfo-data (~> 1.0)
28
+ yajl-ruby (~> 1.0)
29
+ hashdiff (1.0.1)
30
+ http (2.2.2)
31
+ addressable (~> 2.3)
32
+ http-cookie (~> 1.0)
33
+ http-form_data (~> 1.0.1)
34
+ http_parser.rb (~> 0.6.0)
35
+ http-cookie (1.0.3)
36
+ domain_name (~> 0.5)
37
+ http-form_data (1.0.3)
38
+ http_parser.rb (0.6.0)
39
+ msgpack (1.3.3)
40
+ public_suffix (4.0.3)
41
+ rake (12.3.3)
42
+ safe_yaml (1.0.5)
43
+ serverengine (2.2.1)
44
+ sigdump (~> 0.2.2)
45
+ sigdump (0.2.4)
46
+ strptime (0.2.4)
47
+ tzinfo (2.0.2)
48
+ concurrent-ruby (~> 1.0)
49
+ tzinfo-data (1.2020.1)
50
+ tzinfo (>= 1.0.0)
51
+ unf (0.1.4)
52
+ unf_ext
53
+ unf_ext (0.0.7.7)
54
+ webmock (3.8.3)
55
+ addressable (>= 2.3.6)
56
+ crack (>= 0.3.2)
57
+ hashdiff (>= 0.4.0, < 2.0.0)
58
+ yajl-ruby (1.4.1)
59
+
60
+ PLATFORMS
61
+ ruby
62
+
63
+ DEPENDENCIES
64
+ bundler (~> 1.16)
65
+ fluent-plugin-logdna!
66
+ rake (~> 12.3)
67
+ webmock
68
+
69
+ BUNDLED WITH
70
+ 1.17.2
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2016 Answerbook, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,62 @@
1
+ # Generate a debian package for fluent-plugin-logdna
2
+ #
3
+ # This assumes that you have the td-agent package already installed
4
+ # https://docs.fluentd.org/v1.0/articles/install-by-deb
5
+ #
6
+ # The package is created with fpm (it does not necessarily need to be
7
+ # installed into the td-agent embedded ruby). To install fpm run:
8
+ # $ sudo gem install --no-ri --no-rdoc fpm
9
+ #
10
+ # The td-agent package installs an embedded ruby distribution in
11
+ # /opt/td-agent/embedded which has its own list of gems. Our built package
12
+ # cannot conflict with those gems so we will elect to bundle a subset of gems
13
+ # with our package. This may conflict with other packages and this package is
14
+ # not intended to be a general purpose package.
15
+
16
+ # Paths to td-agent specific versions of bundle and gem
17
+ BUNDLE=/opt/td-agent/embedded/bin/bundle
18
+ GEM=/opt/td-agent/embedded/bin/gem
19
+ RUBY=/opt/td-agent/embedded/bin/ruby
20
+ RAKE=/opt/td-agent/embedded/bin/rake
21
+ FPM=fpm
22
+
23
+ # Bundle will unpack gems into the bundle directory
24
+ BUNDLE_DIR=./vendor/bundle
25
+ # Bundle will save gems in the cache directory
26
+ CACHE_DIR=./vendor/cache
27
+ PKG_DIR=pkg
28
+ # Bundle will store settings and locks in the dot_bundle directory
29
+ DOT_BUNDLE=./.bundle
30
+
31
+ GEMSPEC := ${wildcard *.gemspec}
32
+ NAME := ${shell $(RUBY) -e 'puts Gem::Specification::load("$(GEMSPEC)").name'}
33
+ VERSION := ${shell $(RUBY) -e 'puts Gem::Specification::load("$(GEMSPEC)").version.to_s'}
34
+ GEMFILE := ${shell $(RUBY) -e 'puts Gem::Specification::load("$(GEMSPEC)").file_name'}
35
+ DEBFILE := $(NAME)_$(VERSION)_all.deb
36
+
37
+ all: $(DEBFILE)
38
+
39
+ $(BUNDLE_DIR): Gemfile.lock
40
+ $(BUNDLE) install --frozen --path $(BUNDLE_DIR)
41
+
42
+ $(CACHE_DIR): $(BUNDLE_DIR) Gemfile.lock
43
+ $(BUNDLE) package --no-install
44
+
45
+ $(GEMFILE): $(BUNDLE_DIR)
46
+ $(BUNDLE) exec $(GEM) build -V $(GEMSPEC)
47
+
48
+ $(DEBFILE): $(GEMFILE) $(CACHE_DIR)
49
+ $(BUNDLE) exec $(RAKE) gemdep:minimal
50
+ $(FPM) --input-type gem --output-type deb \
51
+ --no-auto-depends \
52
+ --no-gem-fix-name \
53
+ --gem-gem $(GEM) \
54
+ --depends 'td-agent > 2' \
55
+ --deb-build-depends 'td-agent > 2' \
56
+ pkg/*.gem $(GEMFILE)
57
+
58
+ clean:
59
+ -$(BUNDLE) exec $(RAKE) clobber
60
+ rm -rf $(BUNDLE_DIR) $(CACHE_DIR) $(DOT_BUNDLE) $(GEMFILE) $(DEBFILE)
61
+
62
+ .PHONY: all clean
@@ -0,0 +1,80 @@
1
+ # fluent-plugin-logdna
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/fluent-plugin-logdna.svg)](https://badge.fury.io/rb/fluent-plugin-logdna)
4
+
5
+ Using fluent-plugin-logdna, you can send the logs you collect with Fluentd to LogDNA.
6
+
7
+ ## Instructions
8
+
9
+ * Install [Fluentd](http://www.fluentd.org/download)
10
+ * Alternative install if using fluentd package manager (td-agent): `td-agent-gem install fluent-plugin-logdna`
11
+ * Add the contents below to `/etc/fluent/fluent.conf`. For td-agent, use `/etc/td-agent/td-agent.conf`:
12
+ * Alternative install without td-agent is: `gem install fluent-plugin-logdna`
13
+
14
+ ~~~~~configuration
15
+ <match **>
16
+ @type logdna
17
+ api_key xxxxxxxxxxxxxxxxxxxxxxxxxxx # paste your api key here (required)
18
+ hostname "#{Socket.gethostname}" # your hostname (required)
19
+ app my_app # replace with your app name
20
+ #mac C0:FF:EE:C0:FF:EE # optional mac address
21
+ #ip 127.0.0.1 # optional ip address
22
+ #tags web,dev # optional tags
23
+ request_timeout 30000 ms # optional timeout for upload request, supports seconds (s, default) and milliseconds (ms) suffixes, default 30 seconds
24
+ buffer_chunk_limit 1m # do not increase past 8m (8MB) or your logs will be rejected by our server.
25
+ flush_at_shutdown true # only needed with file buffer
26
+ </match>
27
+ ~~~~~
28
+
29
+ * Restart fluentd to pick up the configuration changes.
30
+ * `sudo /etc/init.d/td-agent stop`
31
+ * `sudo /etc/init.d/td-agent start`
32
+
33
+ ### Recommended Configuration Parameters
34
+
35
+ * buffer_type
36
+ * We recommend setting this to memory for development and file for production (file setting requires a buffer_path).
37
+ * buffer_queue_limit, buffer_chunk_limit
38
+ * We do not recommend increasing buffer_chunk_limit past 8MB.
39
+ * flush_interval
40
+ * Default is 60s. We recommend keeping this well above 5s.
41
+ * retry_wait, max_retry_wait, retry_limit, disable_retry_limit
42
+ * We recommend increasing these values if you are encountering problems.
43
+
44
+ ### Options
45
+
46
+ * App name and log level can also be provided on a line-by-line basis over JSON:
47
+ * `_app` and `level` will override the config
48
+
49
+ If you don't have a LogDNA account, you can create one on [https://logdna.com](https://logdna.com) or if you're on macOS w/[Homebrew](https://brew.sh) installed:
50
+
51
+ ~~~~~bash
52
+ brew cask install logdna-cli
53
+ logdna register <email>
54
+ # now paste the api key above
55
+ ~~~~~
56
+
57
+ ### LogDNA Pay-per-gig Pricing
58
+
59
+ Our [paid plans](https://logdna.com/#pricing) start at $1.25/GB per month, pay for what you use / no fixed data buckets / all paid plans include all features.
60
+
61
+ ## Building a debian package for td-agent
62
+
63
+ If you use td-agent you can build a debian package instead of installing via
64
+ td-agent-gem. This requires that td-agent is already installed and that you've
65
+ installed [fpm](http://fpm.readthedocs.io/en/latest/index.html). Then just run
66
+ `make` in your git directory.
67
+
68
+ ~~~~~bash
69
+ gem install --no-ri --no-rdoc fpm
70
+ git clone https://github.com/logdna/fluent-plugin-logdna
71
+ cd fluent-plugin-logdna
72
+ make
73
+ sudo dpkg -i fluent-plugin-logdna*.deb
74
+ ~~~~~
75
+
76
+ ## Additional Options
77
+
78
+ For advanced configuration options, please refer to the [buffered output parameters documentation.](http://docs.fluentd.org/articles/output-plugin-overview#buffered-output-parameters)
79
+
80
+ Questions or concerns? Contact [support@logdna.com](mailto:support@logdna.com).
@@ -0,0 +1,48 @@
1
+ require "set"
2
+
3
+ # Directory to place gems to bundle with our main gem
4
+ PACKAGE_DIR = "pkg"
5
+ require "rake/clean"
6
+ CLOBBER.include PACKAGE_DIR
7
+
8
+ desc "Copies gem dependencies to the #{PACKAGE_DIR} folder"
9
+ task "gemdep" do
10
+ gem_copy gen_gem_list
11
+ end
12
+
13
+ desc "Copies gem dependencies which don't overlap with td-agent to the #{PACKAGE_DIR} folder"
14
+ task "gemdep:minimal" do
15
+ MINIMAL_GEMS = %W[
16
+ unf_ext
17
+ unf
18
+ domain_name
19
+ http-cookie
20
+ http-form_data
21
+ http
22
+ ]
23
+ gem_copy gen_gem_list MINIMAL_GEMS
24
+ end
25
+
26
+ def gen_gem_list(subset = [])
27
+ myself = Bundler.load_gemspec(Dir[File.join(Bundler::SharedHelpers.pwd, "{,*}.gemspec")].first)
28
+ to_pull = Set[]
29
+ Bundler.locked_gems.specs.each do |spec|
30
+ next if spec.name == myself.name
31
+ if subset.empty?
32
+ to_pull.add(spec)
33
+ else
34
+ if subset.include? spec.name
35
+ to_pull.add(spec)
36
+ end
37
+ end
38
+ end
39
+ to_pull
40
+ end
41
+
42
+ # This assumes that bundle install has already been run (which populates
43
+ # Bundler.app_cache with the gems of dependencies).
44
+ def gem_copy(specs)
45
+ Bundler.mkdir_p PACKAGE_DIR
46
+ sources = specs.collect { |s| Bundler.app_cache.join "#{s.full_name}.gem" }
47
+ FileUtils.cp sources, PACKAGE_DIR, :verbose => true
48
+ end
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'date'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'fluent-plugin-logdna'
6
+ s.version = '0.3.1'
7
+ s.date = Date.today.to_s
8
+ s.summary = 'LogDNA plugin for Fluentd'
9
+ s.description = 'Fluentd plugin for supplying output to LogDNA.'
10
+ s.authors = ['Edwin Lai']
11
+ s.email = 'edwin@logdna.com'
12
+ s.files = ['lib/fluent/plugin/out_logdna.rb']
13
+ s.homepage = 'https://github.com/logdna/fluent-plugin-logdna'
14
+ s.license = 'MIT'
15
+
16
+ s.require_paths = ['lib']
17
+ s.files = `git ls-files -z`.split("\x0")
18
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ s.required_ruby_version = Gem::Requirement.new('>= 2.0.0')
20
+ s.add_development_dependency "bundler", "~> 1.16"
21
+ s.add_runtime_dependency 'fluentd', '>= 0.12.0', '< 2'
22
+ s.add_runtime_dependency 'http', '~> 2.0', '>= 2.0.3'
23
+ end
@@ -0,0 +1,107 @@
1
+ require 'fluent/output'
2
+
3
+ module Fluent
4
+ class LogDNAOutput < Fluent::BufferedOutput
5
+ Fluent::Plugin.register_output('logdna', self)
6
+
7
+ MAX_RETRIES = 5
8
+
9
+ config_param :api_key, :string, secret: true
10
+ config_param :hostname, :string
11
+ config_param :mac, :string, default: nil
12
+ config_param :tags, :string, default: nil
13
+ config_param :ip, :string, default: nil
14
+ config_param :app, :string, default: nil
15
+ config_param :file, :string, default: nil
16
+ config_param :ingester_domain, :string, default: 'https://logs.logdna.com'
17
+ config_param :request_timeout, :string, default: '30'
18
+
19
+ def configure(conf)
20
+ super
21
+ @host = conf['hostname']
22
+
23
+ # make these two variables globals
24
+ timeout_unit_map = { s: 1.0, ms: 0.001 }
25
+ timeout_regex = Regexp.new("^([0-9]+)\s*(#{timeout_unit_map.keys.join("|")})$")
26
+
27
+ # this section goes into this part of the code
28
+ num_component = 30.0
29
+ unit_component = 's'
30
+
31
+ timeout_regex.match(@request_timeout) do |match|
32
+ num_component = match[1].to_f
33
+ unit_component = match[2]
34
+ end
35
+
36
+ @request_timeout = num_component * timeout_unit_map[unit_component.to_sym]
37
+ end
38
+
39
+ def start
40
+ super
41
+ require 'json'
42
+ require 'base64'
43
+ require 'http'
44
+ HTTP.default_options = { :keep_alive_timeout => 60 }
45
+ @ingester = HTTP.persistent @ingester_domain
46
+ @requests = Queue.new
47
+ end
48
+
49
+ def shutdown
50
+ super
51
+ @ingester.close if @ingester
52
+ end
53
+
54
+ def format(tag, time, record)
55
+ [tag, time, record].to_msgpack
56
+ end
57
+
58
+ def write(chunk)
59
+ body = chunk_to_body(chunk)
60
+ response = send_request(body)
61
+ raise 'Encountered server error' if response.code >= 400
62
+ response.flush
63
+ end
64
+
65
+ private
66
+
67
+ def chunk_to_body(chunk)
68
+ data = []
69
+
70
+ chunk.msgpack_each do |(tag, time, record)|
71
+ line = gather_line_data(tag, time, record)
72
+ data << line unless line[:line].empty?
73
+ end
74
+
75
+ { lines: data }
76
+ end
77
+
78
+ def gather_line_data(tag, time, record)
79
+ line = {
80
+ level: record['level'] || record['severity'] || tag.split('.').last,
81
+ timestamp: time,
82
+ line: record.to_json
83
+ }
84
+ # At least one of "file" or "app" is required.
85
+ line[:file] = record['file']
86
+ line[:file] ||= @file if @file
87
+ line.delete(:file) if line[:file].nil?
88
+ line[:app] = record['_app'] || record['app']
89
+ line[:app] ||= @app if @app
90
+ line.delete(:app) if line[:app].nil?
91
+ line[:env] = record['env']
92
+ line.delete(:env) if line[:env].nil?
93
+ line[:meta] = record['meta']
94
+ line.delete(:meta) if line[:meta].nil?
95
+ line
96
+ end
97
+
98
+ def send_request(body)
99
+ now = Time.now.to_i
100
+ url = "/logs/ingest?hostname=#{@host}&mac=#{@mac}&ip=#{@ip}&now=#{now}&tags=#{@tags}"
101
+ @ingester.headers('apikey' => @api_key,
102
+ 'content-type' => 'application/json')
103
+ .timeout(connect: @request_timeout, write: @request_timeout, read: @request_timeout)
104
+ .post(url, json: body)
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,8 @@
1
+ $LOAD_PATH.unshift(File.expand_path("../../", __FILE__))
2
+ require "test-unit"
3
+ require "fluent/test"
4
+ require "fluent/test/driver/output"
5
+ require "fluent/test/helpers"
6
+
7
+ Test::Unit::TestCase.include(Fluent::Test::Helpers)
8
+ Test::Unit::TestCase.extend(Fluent::Test::Helpers)
@@ -0,0 +1,110 @@
1
+ # https://docs.fluentd.org/plugin-development/api-plugin-output#how-to-write-tests
2
+
3
+ require_relative '../helper'
4
+ require 'fluent/test/driver/output'
5
+ require 'fluent/plugin/out_stdout'
6
+ require 'fluent/plugin/input'
7
+ require 'webmock/test_unit'
8
+ include WebMock::API
9
+
10
+ require 'lib/fluent/plugin/out_logdna.rb'
11
+
12
+ class LogdnaOutputTest < Test::Unit::TestCase
13
+ def setup
14
+ Fluent::Test.setup
15
+
16
+ stub_request(:post, /logs.logdna.com\/logs\/ingest/)
17
+ end
18
+
19
+ # default configuration for tests
20
+ CONFIG = %[
21
+ api_key this-is-my-key
22
+ hostname "localhost"
23
+ app my_app
24
+ mac C0:FF:EE:C0:FF:EE
25
+ ip 127.0.0.1
26
+ tags "my-tag"
27
+ ]
28
+
29
+ def create_driver(conf = CONFIG)
30
+ Fluent::Test::Driver::Output.new(Fluent::LogDNAOutput).configure(conf)
31
+ end
32
+
33
+ sub_test_case 'configuration' do
34
+ test 'instantiate the plugin and check default config values' do
35
+ d = create_driver
36
+ time = event_time
37
+
38
+ # check defaults
39
+ assert_equal 'https://logs.logdna.com', d.instance.ingester_domain
40
+ assert_equal 30, d.instance.request_timeout
41
+ end
42
+
43
+ test 'instantiate the plugin and check setting config values' do
44
+ conf = %[
45
+ api_key this-is-my-key
46
+ hostname "localhost"
47
+ app my_app
48
+ mac C0:FF:EE:C0:FF:EE
49
+ ip 127.0.0.1
50
+ tags "my-tag"
51
+ request_timeout 17s
52
+ ]
53
+
54
+ d = create_driver(conf)
55
+
56
+ # check set config values
57
+ assert_equal 'my-tag', d.instance.tags
58
+ assert_equal 17, d.instance.request_timeout
59
+ end
60
+
61
+ test 'instantiate the plugin with ms request_timeout value' do
62
+
63
+ conf = %[
64
+ api_key this-is-my-key
65
+ hostname "localhost"
66
+ app my_app
67
+ mac C0:FF:EE:C0:FF:EE
68
+ ip 127.0.0.1
69
+ tags "my-tag"
70
+ request_timeout 17000 ms
71
+ ]
72
+
73
+ d = create_driver(conf)
74
+
75
+ # check set config values
76
+ assert_equal 17, d.instance.request_timeout
77
+ end
78
+
79
+ test 'instantiate the plugin with nonesense request_timeout value' do
80
+
81
+ conf = %[
82
+ api_key this-is-my-key
83
+ hostname "localhost"
84
+ app my_app
85
+ mac C0:FF:EE:C0:FF:EE
86
+ ip 127.0.0.1
87
+ tags "my-tag"
88
+ request_timeout "asdf ms"
89
+ ]
90
+
91
+ d = create_driver(conf)
92
+
93
+ # check set config values
94
+ assert_equal 30, d.instance.request_timeout
95
+ end
96
+ end
97
+
98
+ test 'simple #write' do
99
+ d = create_driver
100
+ time = event_time
101
+
102
+ d.run do
103
+ d.feed("output.test", time, {'foo' => 'bar', 'message' => 'myLine'})
104
+ d.feed("output.test", time, {'foo' => 'bar', 'message' => 'myLine'})
105
+ end
106
+
107
+ assert_equal(2, d.formatted.size)
108
+ end
109
+
110
+ end
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluent-plugin-logdna
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.1
5
+ platform: ruby
6
+ authors:
7
+ - Edwin Lai
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-07-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: fluentd
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.12.0
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '2'
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 0.12.0
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '2'
47
+ - !ruby/object:Gem::Dependency
48
+ name: http
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '2.0'
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 2.0.3
57
+ type: :runtime
58
+ prerelease: false
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - "~>"
62
+ - !ruby/object:Gem::Version
63
+ version: '2.0'
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 2.0.3
67
+ description: Fluentd plugin for supplying output to LogDNA.
68
+ email: edwin@logdna.com
69
+ executables: []
70
+ extensions: []
71
+ extra_rdoc_files: []
72
+ files:
73
+ - ".gitignore"
74
+ - ".ruby-version"
75
+ - Gemfile
76
+ - Gemfile.lock
77
+ - LICENSE
78
+ - Makefile
79
+ - README.md
80
+ - Rakefile
81
+ - fluent-plugin-logdna.gemspec
82
+ - lib/fluent/plugin/out_logdna.rb
83
+ - test/helper.rb
84
+ - test/plugin/test_out_logdna.rb
85
+ homepage: https://github.com/logdna/fluent-plugin-logdna
86
+ licenses:
87
+ - MIT
88
+ metadata: {}
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: 2.0.0
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubygems_version: 3.0.3
105
+ signing_key:
106
+ specification_version: 4
107
+ summary: LogDNA plugin for Fluentd
108
+ test_files: []