fluent-plugin-tail-multiline 0.1.4 → 0.1.5

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,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MmRjNjI2YTUyZjE4NDRmNjg1NGI4YzNlOWJkNmZkOWE0M2YwNDA5YQ==
5
+ data.tar.gz: !binary |-
6
+ NWU0YzczOTg2ZWFiY2EzYmMxZTE3ZDUxZDc0M2M4YzVmM2M5Yjk2MQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NjJjNjE4M2E3NGQ5NDM4ZjBlYjZkMjk5ZGE1MGI0Y2NmOTc5MmQ2MDAzNjZh
10
+ MTZiYjFkY2M3ZDU1NjlkNGJhNGFiZWFjODY3ZTY1N2FhZjcxMjBiYzJmNzE2
11
+ ZTI0ZWUxYmU1ZGJlOGMxN2M0MDRlMzM4MTU0MWJiNDhiZGNjMTE=
12
+ data.tar.gz: !binary |-
13
+ ZjBmYjk3ODQ3MzUwMTY5MzhjZjE3ZGVhOGRhY2MwMGEyYmM2MTYzNTI1Y2Fh
14
+ NzBlOGZhMGMwYzYzMjliZjJmOTNmNzNlYTE1ODg0ZTk0OWQ1ZGY4YzQ3N2Zj
15
+ MDZjMzZjZTk3YjIxMDM3OGFhODE2ZWNjNTM3MzU2ZTRmODNmYjA=
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "fluent-plugin-tail-multiline"
7
- gem.version = "0.1.4"
7
+ gem.version = "0.1.5"
8
8
  gem.authors = ["Tomohisa Ota"]
9
9
  gem.email = ["tomohisa.ota+github@gmail.com"]
10
10
  gem.description = "Extend tail plugin to support log with multiple line"
@@ -20,11 +20,7 @@ module Fluent
20
20
  raise ConfigError, "Invalid regexp in format '#{format[1..-2]}': #{$!}"
21
21
  end
22
22
 
23
- @parser = RegexpParser.new(@regex)
24
-
25
- if @parser.respond_to?(:configure)
26
- @parser.configure(conf)
27
- end
23
+ @parser = RegexpParser.new(@regex, conf)
28
24
 
29
25
  format_firstline = conf['format_firstline']
30
26
  if format_firstline
@@ -19,6 +19,70 @@ class TailMultilineInputTest < Test::Unit::TestCase
19
19
  Fluent::Test::InputTestDriver.new(Fluent::TailMultilineInput).configure(conf)
20
20
  end
21
21
 
22
+ def test_emit_time_format
23
+ tmpFile = Tempfile.new("in_tail_multiline-")
24
+ begin
25
+ d = create_driver %[
26
+ path #{tmpFile.path}
27
+ tag test
28
+ format /^(?<time>[^ ]* [^ ]*) [s|f] (?<message>.*)/
29
+ time_format %m-%d-%Y %H:%M:%S
30
+ ]
31
+ d.run do
32
+ File.open(tmpFile.path, "w") {|f|
33
+ f.puts "12-24-2012 10:20:30 f test1"
34
+ }
35
+ sleep 1
36
+ end
37
+
38
+ emits = d.emits
39
+ assert_equal(true, emits.length > 0)
40
+ assert_equal({"message"=>"test1"}, emits[0][2])
41
+
42
+ t = Time.at(emits[0][1])
43
+ assert_equal(2012, t.year)
44
+ assert_equal(12, t.month)
45
+ assert_equal(24, t.day)
46
+ assert_equal(10, t.hour)
47
+ assert_equal(20, t.min)
48
+ assert_equal(30, t.sec)
49
+ ensure
50
+ tmpFile.close(true)
51
+ end
52
+ end
53
+
54
+ def test_emit_custom_time_format
55
+ tmpFile = Tempfile.new("in_tail_multiline-")
56
+ begin
57
+ d = create_driver %[
58
+ path #{tmpFile.path}
59
+ tag test
60
+ format /^(?<time>[^ ]* [^ ]*) [s|f] (?<message>.*)/
61
+ time_format %m-%d %H:%M:%S
62
+ ]
63
+ d.run do
64
+ File.open(tmpFile.path, "w") {|f|
65
+ f.puts "12-24 10:20:30 f test1"
66
+ }
67
+ sleep 1
68
+ end
69
+
70
+ emits = d.emits
71
+ assert_equal(true, emits.length > 0)
72
+ assert_equal({"message"=>"test1"}, emits[0][2])
73
+
74
+ t = Time.at(emits[0][1])
75
+ assert_equal(Time.new.year, t.year)
76
+ assert_equal(12, t.month)
77
+ assert_equal(24, t.day)
78
+ assert_equal(10, t.hour)
79
+ assert_equal(20, t.min)
80
+ assert_equal(30, t.sec)
81
+ ensure
82
+ tmpFile.close(true)
83
+ end
84
+ end
85
+
22
86
  def test_emit_no_additional_option
23
87
  tmpFile = Tempfile.new("in_tail_multiline-")
24
88
  begin
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-tail-multiline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
5
- prerelease:
4
+ version: 0.1.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tomohisa Ota
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-08-07 00:00:00.000000000 Z
11
+ date: 2013-12-26 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: fluentd
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -45,27 +42,26 @@ files:
45
42
  - test/plugin/test_in_tail_multiline.rb
46
43
  homepage: http://github.com/tomohisaota/fluent-plugin-tail-multiline
47
44
  licenses: []
45
+ metadata: {}
48
46
  post_install_message:
49
47
  rdoc_options: []
50
48
  require_paths:
51
49
  - lib
52
50
  required_ruby_version: !ruby/object:Gem::Requirement
53
- none: false
54
51
  requirements:
55
52
  - - ! '>='
56
53
  - !ruby/object:Gem::Version
57
54
  version: '0'
58
55
  required_rubygems_version: !ruby/object:Gem::Requirement
59
- none: false
60
56
  requirements:
61
57
  - - ! '>='
62
58
  - !ruby/object:Gem::Version
63
59
  version: '0'
64
60
  requirements: []
65
61
  rubyforge_project:
66
- rubygems_version: 1.8.25
62
+ rubygems_version: 2.1.11
67
63
  signing_key:
68
- specification_version: 3
64
+ specification_version: 4
69
65
  summary: Extend tail plugin to support log with multiple line
70
66
  test_files:
71
67
  - test/helper.rb