fluent-plugin-logdna 0.1.7 → 0.1.8

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 CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YjQ0M2E5NzA3ZmUxM2VlMjg0ZTJmMTgyYmM1M2Q5YjI0YjZiZTRiMQ==
5
- data.tar.gz: !binary |-
6
- YmU2ZmViY2E0MTg4MzI0OTNkZTVjZDhhZDUxMDZjMWE4NTM4YjcxYQ==
2
+ SHA1:
3
+ metadata.gz: c2936edd3832b6adeec6b66aecd85b3e7535824a
4
+ data.tar.gz: 331fa28c467e2eaf655a8efb703ea8bf8990f053
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MDVlNTBiMDQ1MWRmMzcxMzdiZDg0M2I0OWE4MmVhODRmY2VjZWI5ZjE4YmM1
10
- NzBkMTQwMzY3NzliMTVmYzgxMjMyM2Q2NzA2NDA5MDZjNDM0ZDJiZDEwNWU0
11
- NzlkY2ExYWYwNTFlZmM0ZTQ0ZDRmZDk2OTAyZGUyNzU0NzBhYzQ=
12
- data.tar.gz: !binary |-
13
- N2JiZjBkMjAxNGQ2ZTcyYWU0OGJmMTZjYzY3YzhiNzU0NjA5MmUyNjM2NTI0
14
- MjA2YzFmNjg4MzRjZDFkYjA1YmI2ZGE5ODlhYjg5MGJhY2FiZWZlNzE3ZjBk
15
- OThjN2NjZjA4MWRlN2E5OWJhNjU5ZDEyMWIxNWEwZjA2MThjYWY=
6
+ metadata.gz: 4043ab49a5f298e32f11a92ce990d39537ab94253498b639d16b809c24ebf69d718f663b55f8071f0f704494c0739d591aedcb393392573785a2b955c75f15c7
7
+ data.tar.gz: 28a47a041aa02974066142503c478aa2a429b250ed652e65c8246851d6bcbc675c8066935c3cc83e7b06332ba24ae14a1a1985c87dc12aedb1c8d61f0c414e07
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem "rake", "~> 12.3"
@@ -0,0 +1,63 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ fluent-plugin-logdna (0.1.7.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.5.2)
12
+ public_suffix (>= 2.0.2, < 4.0)
13
+ cool.io (1.5.3)
14
+ dig_rb (1.0.1)
15
+ domain_name (0.5.20180417)
16
+ unf (>= 0.0.5, < 1.0.0)
17
+ fluentd (1.0.2)
18
+ cool.io (>= 1.4.5, < 2.0.0)
19
+ dig_rb (~> 1.0.0)
20
+ http_parser.rb (>= 0.5.1, < 0.7.0)
21
+ msgpack (>= 0.7.0, < 2.0.0)
22
+ serverengine (>= 2.0.4, < 3.0.0)
23
+ sigdump (~> 0.2.2)
24
+ strptime (~> 0.1)
25
+ tzinfo (~> 1.0)
26
+ tzinfo-data (~> 1.0)
27
+ yajl-ruby (~> 1.0)
28
+ http (2.2.2)
29
+ addressable (~> 2.3)
30
+ http-cookie (~> 1.0)
31
+ http-form_data (~> 1.0.1)
32
+ http_parser.rb (~> 0.6.0)
33
+ http-cookie (1.0.3)
34
+ domain_name (~> 0.5)
35
+ http-form_data (1.0.3)
36
+ http_parser.rb (0.6.0)
37
+ msgpack (1.2.0)
38
+ public_suffix (3.0.1)
39
+ rake (12.3.1)
40
+ serverengine (2.0.5)
41
+ sigdump (~> 0.2.2)
42
+ sigdump (0.2.4)
43
+ strptime (0.1.9)
44
+ thread_safe (0.3.6)
45
+ tzinfo (1.2.4)
46
+ thread_safe (~> 0.1)
47
+ tzinfo-data (1.2017.3)
48
+ tzinfo (>= 1.0.0)
49
+ unf (0.1.4)
50
+ unf_ext
51
+ unf_ext (0.0.7.5)
52
+ yajl-ruby (1.3.1)
53
+
54
+ PLATFORMS
55
+ ruby
56
+
57
+ DEPENDENCIES
58
+ bundler (~> 1.16)
59
+ fluent-plugin-logdna!
60
+ rake (~> 12.3)
61
+
62
+ BUNDLED WITH
63
+ 1.16.0
@@ -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
data/README.md CHANGED
@@ -52,6 +52,20 @@ logdna register <email>
52
52
 
53
53
  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.
54
54
 
55
+ ## Building a debian package for td-agent
56
+ If you use td-agent you can build a debian package instead of installing via
57
+ td-agent-gem. This requires that td-agent is already installed and that you've
58
+ installed [fpm](http://fpm.readthedocs.io/en/latest/index.html). Then just run
59
+ `make` in your git directory.
60
+
61
+ ```
62
+ gem install --no-ri --no-rdoc fpm
63
+ git clone https://github.com/logdna/fluent-plugin-logdna
64
+ cd fluent-plugin-logdna
65
+ make
66
+ sudo dpkg -i fluent-plugin-logdna*.deb
67
+ ```
68
+
55
69
  ## Additional Options
56
70
 
57
71
  For advanced configuration options, please refer to the [buffered output parameters documentation.](http://docs.fluentd.org/articles/output-plugin-overview#buffered-output-parameters)
@@ -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
@@ -3,12 +3,12 @@ require 'date'
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'fluent-plugin-logdna'
6
- s.version = '0.1.7'
6
+ s.version = '0.1.8'
7
7
  s.date = Date.today.to_s
8
8
  s.summary = 'LogDNA plugin for Fluentd'
9
9
  s.description = 'Fluentd plugin for supplying output to LogDNA.'
10
- s.authors = ['Edwin Lai']
11
- s.email = 'edwin@logdna.com'
10
+ s.authors = ['LogDNA']
11
+ s.email = 'support@logdna.com'
12
12
  s.files = ['lib/fluent/plugin/out_logdna.rb']
13
13
  s.homepage = 'https://github.com/logdna/fluent-plugin-logdna'
14
14
  s.license = 'MIT'
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.files = `git ls-files -z`.split("\x0")
18
18
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
19
  s.required_ruby_version = Gem::Requirement.new('>= 2.0.0')
20
+ s.add_development_dependency "bundler", "~> 1.16"
20
21
  s.add_runtime_dependency 'fluentd', '>= 0.12.0', '< 2'
21
22
  s.add_runtime_dependency 'http', '~> 2.0', '>= 2.0.3'
22
23
  end
@@ -4,7 +4,6 @@ module Fluent
4
4
  class LogDNAOutput < Fluent::BufferedOutput
5
5
  Fluent::Plugin.register_output('logdna', self)
6
6
 
7
- INGESTER_DOMAIN = 'https://logs.logdna.com'.freeze
8
7
  MAX_RETRIES = 5
9
8
 
10
9
  config_param :api_key, :string, secret: true
@@ -12,6 +11,8 @@ module Fluent
12
11
  config_param :mac, :string, default: nil
13
12
  config_param :ip, :string, default: nil
14
13
  config_param :app, :string, default: nil
14
+ config_param :file, :string, default: nil
15
+ config_param :ingester_domain, :string, default: 'https://logs.logdna.com'
15
16
 
16
17
  def configure(conf)
17
18
  super
@@ -24,7 +25,7 @@ module Fluent
24
25
  require 'base64'
25
26
  require 'http'
26
27
  HTTP.default_options = { :keep_alive_timeout => 60 }
27
- @ingester = HTTP.persistent INGESTER_DOMAIN
28
+ @ingester = HTTP.persistent @ingester_domain
28
29
  @requests = Queue.new
29
30
  end
30
31
 
@@ -61,11 +62,19 @@ module Fluent
61
62
  line = {
62
63
  level: record['level'] || record['severity'] || tag.split('.').last,
63
64
  timestamp: time,
64
- line: record['message'] || record.to_json
65
+ line: record.to_json
65
66
  }
67
+ # At least one of "file" or "app" is required.
68
+ line[:file] = record['file']
69
+ line[:file] ||= @file if @file
70
+ line.delete(:file) if line[:file].nil?
66
71
  line[:app] = record['_app'] || record['app']
67
72
  line[:app] ||= @app if @app
68
73
  line.delete(:app) if line[:app].nil?
74
+ line[:env] = record['env']
75
+ line.delete(:env) if line[:env].nil?
76
+ line[:meta] = record['meta']
77
+ line.delete(:meta) if line[:meta].nil?
69
78
  line
70
79
  end
71
80
 
metadata CHANGED
@@ -1,65 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-logdna
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
- - Edwin Lai
7
+ - LogDNA
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-20 00:00:00.000000000 Z
11
+ date: 2019-03-20 00:00:00.000000000 Z
12
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'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: fluentd
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
- - - ! '>='
31
+ - - ">="
18
32
  - !ruby/object:Gem::Version
19
33
  version: 0.12.0
20
- - - <
34
+ - - "<"
21
35
  - !ruby/object:Gem::Version
22
36
  version: '2'
23
37
  type: :runtime
24
38
  prerelease: false
25
39
  version_requirements: !ruby/object:Gem::Requirement
26
40
  requirements:
27
- - - ! '>='
41
+ - - ">="
28
42
  - !ruby/object:Gem::Version
29
43
  version: 0.12.0
30
- - - <
44
+ - - "<"
31
45
  - !ruby/object:Gem::Version
32
46
  version: '2'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: http
35
49
  requirement: !ruby/object:Gem::Requirement
36
50
  requirements:
37
- - - ~>
51
+ - - "~>"
38
52
  - !ruby/object:Gem::Version
39
53
  version: '2.0'
40
- - - ! '>='
54
+ - - ">="
41
55
  - !ruby/object:Gem::Version
42
56
  version: 2.0.3
43
57
  type: :runtime
44
58
  prerelease: false
45
59
  version_requirements: !ruby/object:Gem::Requirement
46
60
  requirements:
47
- - - ~>
61
+ - - "~>"
48
62
  - !ruby/object:Gem::Version
49
63
  version: '2.0'
50
- - - ! '>='
64
+ - - ">="
51
65
  - !ruby/object:Gem::Version
52
66
  version: 2.0.3
53
67
  description: Fluentd plugin for supplying output to LogDNA.
54
- email: edwin@logdna.com
68
+ email: support@logdna.com
55
69
  executables: []
56
70
  extensions: []
57
71
  extra_rdoc_files: []
58
72
  files:
59
- - .gitignore
60
- - .ruby-version
73
+ - ".gitignore"
74
+ - ".ruby-version"
75
+ - Gemfile
76
+ - Gemfile.lock
61
77
  - LICENSE
78
+ - Makefile
62
79
  - README.md
80
+ - Rakefile
63
81
  - fluent-plugin-logdna.gemspec
64
82
  - lib/fluent/plugin/out_logdna.rb
65
83
  homepage: https://github.com/logdna/fluent-plugin-logdna
@@ -72,17 +90,17 @@ require_paths:
72
90
  - lib
73
91
  required_ruby_version: !ruby/object:Gem::Requirement
74
92
  requirements:
75
- - - ! '>='
93
+ - - ">="
76
94
  - !ruby/object:Gem::Version
77
95
  version: 2.0.0
78
96
  required_rubygems_version: !ruby/object:Gem::Requirement
79
97
  requirements:
80
- - - ! '>='
98
+ - - ">="
81
99
  - !ruby/object:Gem::Version
82
100
  version: '0'
83
101
  requirements: []
84
102
  rubyforge_project:
85
- rubygems_version: 2.6.11
103
+ rubygems_version: 2.5.2.3
86
104
  signing_key:
87
105
  specification_version: 4
88
106
  summary: LogDNA plugin for Fluentd