fluent-plugin-simple-logentries 0.1.0 → 0.1.1

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: 06e733cb821b8f88bf7120c955bc9b4a3e448d35
4
- data.tar.gz: 20a8207684c939d30320cfd934090fd30ed16df9
3
+ metadata.gz: 6dafc9f608e3b911510e76d89cf0c1bd9ea51bcd
4
+ data.tar.gz: e18cb26eb01fd0ca79f9bba94ff7ef8ee0e3538f
5
5
  SHA512:
6
- metadata.gz: e2f8de1f82ab72e5395587bf527a11e17d31eadb5f030949b53613dcc9779209c8501b22be75e41e29cd0b7ab7a7b65402697e166223e9d7ec3a7fbc29d5270c
7
- data.tar.gz: 1507e874c7e97992468235b934477fb9ad63c07fbe64e4f4f4ac00052411e2f059b2ca888567b87127d352f8c4c3ba40f92517d780cc64f8d519eacf8fe56137
6
+ metadata.gz: 0203ac1e83df2a3a04dcd0c47b2a20f5ccc70631d07859e9204ee1662385488f0e1177eaf927154c527624ca59f416fe19d08ed97c482623205575780d95a0e1
7
+ data.tar.gz: 5306980edc8b63a63e16ca7cf240b78d44917762f77780c7fb511bca8f986c488085612e0d2973ae94beebbb70b9838572fcb6ba9d1c144dc5920acfb06df88e
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-plugin-simple-logentries"
7
- spec.version = "0.1.0"
7
+ spec.version = "0.1.1"
8
8
  spec.description = "Push fluent events to Logentries"
9
9
  spec.authors = ["sowawa"]
10
10
  spec.email = ["kesiuke.sogawa@gmail.com"]
@@ -20,7 +20,6 @@ class Fluent::SimpleLogentriesOutput < Fluent::BufferedOutput
20
20
 
21
21
  def configure(conf)
22
22
  super
23
- @last_edit = Time.at(0)
24
23
  end
25
24
 
26
25
  def start
@@ -76,7 +75,8 @@ class Fluent::SimpleLogentriesOutput < Fluent::BufferedOutput
76
75
  elsif data.member?('messages')
77
76
  data['messages']
78
77
  end
79
- data.delete(:messages) && data.delete('messages')
78
+ data.delete(:messages)
79
+ data.delete('messages')
80
80
  ([data] + split_messages(messages).map{|i| {messages: i}} ).each_with_index { |item, idx|
81
81
  push(JSON.generate({sequence: idx, identifyer: identifyer}.merge(item)))
82
82
  }
@@ -106,9 +106,26 @@ class Fluent::SimpleLogentriesOutput < Fluent::BufferedOutput
106
106
  end
107
107
 
108
108
  def split_messages(messages)
109
- str_length = messages.length
110
- return [messages] if SPLITED_ENTRY_SIZE > str_length
111
- split_messages(messages[0..str_length/2]) +
112
- split_messages(messages[(str_length/2)+1..str_length])
109
+ if messages.is_a? String
110
+ str_length = messages.length
111
+ return [messages] if SPLITED_ENTRY_SIZE > str_length
112
+ return split_messages(messages[0..str_length/2-1]) +
113
+ split_messages(messages[(str_length/2)..str_length])
114
+ elsif messages.is_a? Array
115
+ arr_length = messages.length
116
+ jsonfied = JSON.generate(messages)
117
+ str_length = jsonfied.length
118
+ return [messages] if SPLITED_ENTRY_SIZE > str_length
119
+ if arr_length == 1
120
+ split_messages(messages[0])
121
+ else
122
+ return split_messages(messages[0..arr_length/2-1]) +
123
+ split_messages(messages[(arr_length/2)..arr_length])
124
+ end
125
+ elsif messages.is_a? Hash
126
+ return split_messages(JSON.generate(messages))
127
+ else
128
+ raise TypeError, "Can't split unknown data type."
129
+ end
113
130
  end
114
131
  end
@@ -3,6 +3,6 @@
3
3
  </source>
4
4
  <match rails.**>
5
5
  type simple-logentries
6
- token 08f1b304-7b73-49d3-829a-49ab3b60ca37
7
- flush_interval 2s
6
+ token 01b442e1-b695-4b07-bce3-71bb885a1a0e
7
+ flush_interval 1s
8
8
  </match>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-simple-logentries
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sowawa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-29 00:00:00.000000000 Z
11
+ date: 2015-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -49,7 +49,7 @@ files:
49
49
  - Gemfile
50
50
  - fluent-plugin-simple-logentries.gemspec
51
51
  - lib/fluent/plugin/out_simple-logentries.rb
52
- - test.conf
52
+ - test.conf.sample
53
53
  homepage: https://github.com/sowawa/fluent-plugin-simple-logentries
54
54
  licenses:
55
55
  - MIT