fluent-plugin-logzio 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 62ec2ef7d97bae772a4a192b40e5a96a7d5881c2
4
- data.tar.gz: 33d16ac0fde96f99587cf2c0f54ad8ecc899cac3
3
+ metadata.gz: 53a6f11cf7cc76a1a040f4ffcb6a74f9c7092cc1
4
+ data.tar.gz: ae119c5cf7e4a9df8ff7957ed00b9af96e5ac973
5
5
  SHA512:
6
- metadata.gz: aef075bc7af4368c42bd5da57330826b97de83366b3953c64c6b7b036781962446320c1e72cd7e2df6c744c68e1266fa0b4deabf6c3ada449b91c61e97231d67
7
- data.tar.gz: a2c3fe9527fa45564b0904e9f88b8ea966542bec944bfc95bdf5a72f9f790240d67c3c5e88c33b668d10e60292b81b53510aa55b522868e68d8b58c175a45f78
6
+ metadata.gz: 446b665e7978fc897e59b48241a3f114e8174609473c782bb0a882a04022553a8e62bd19695f0f79975717242d626de1b092658e101f3178e2497324240f2e59
7
+ data.tar.gz: 39d0c1c09cf89ee70100f733551959fe07e7f2160d92ec17e71fc9abf535b620cdcecf38adb1b7cb8af411a40eb422d1195ee9a9229031d75b0c4e2e5338174a
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'fluent-plugin-logzio'
7
- s.version = '0.0.11'
7
+ s.version = '0.0.12'
8
8
  s.authors = ['Yury Kotov', 'Roi Rav-Hon']
9
9
  s.email = ['bairkan@gmail.com', 'roi@logz.io']
10
10
  s.homepage = 'https://github.com/logzio/fluent-plugin-logzio'
@@ -2,6 +2,9 @@ module Fluent
2
2
  class LogzioOutput < Fluent::Output
3
3
  Fluent::Plugin.register_output('logzio', self)
4
4
  config_param :endpoint_url, :string, default: nil
5
+ config_param :output_include_time, :bool, default: true
6
+ config_param :output_include_tags, :bool, default: true
7
+ config_param :output_tags_fieldname, :string, default: 'fluentd_tags'
5
8
 
6
9
  def configure(conf)
7
10
  super
@@ -23,6 +26,8 @@ module Fluent
23
26
  def emit(tag, es, chain)
24
27
  chain.next
25
28
  es.each {|time,record|
29
+ record['@timestamp'] ||= Time.at(time).iso8601(3) if @output_include_time
30
+ record[@output_tags_fieldname] ||= tag.to_s if @output_include_tags
26
31
  record_json = Yajl.dump(record)
27
32
  log.debug "Record sent #{record_json}"
28
33
  post = Net::HTTP::Post.new @uri.request_uri
@@ -2,15 +2,20 @@ require 'spec_helper'
2
2
 
3
3
  describe 'Fluent::LogzioOutput' do
4
4
  let(:driver) { Fluent::Test::OutputTestDriver.new(Fluent::LogzioOutput).configure(config) }
5
- let(:config) { %[endpoint_url https://logz.io?token=123] }
5
+ let(:config) do
6
+ %[
7
+ endpoint_url https://logz.io?token=123
8
+ output_include_time false
9
+ ]
10
+ end
6
11
 
7
12
  include_context 'output context'
8
13
  include_examples 'output examples'
9
14
 
10
15
  describe 'emit' do
11
16
  before(:each) do
12
- expect(request).to receive(:body=).with('{"field1":50,"otherfield":99}')
13
- expect(request).to receive(:body=).with('{"field1":150,"otherfield":199}')
17
+ expect(request).to receive(:body=).with('{"field1":50,"otherfield":99,"fluentd_tags":"test"}')
18
+ expect(request).to receive(:body=).with('{"field1":150,"otherfield":199,"fluentd_tags":"test"}')
14
19
  expect(Net::HTTP::Post).to receive(:new).with('/?token=123').twice.and_return(request)
15
20
  expect_any_instance_of(Net::HTTP::Persistent).to receive(:request).twice.and_return(response)
16
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-logzio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yury Kotov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-07-09 00:00:00.000000000 Z
12
+ date: 2017-07-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-http-persistent