fluent-plugin-event-tail 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.md +2 -2
- data/fluent-plugin-event-tail.gemspec +1 -1
- data/lib/fluent/plugin/in_event_tail.rb +17 -11
- metadata +6 -11
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZjdkNGNkYmQ0MTUzNjljNmVmOTFlYWM1NWMzNTU1MjFkN2IwMjQ2YQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MTVjMmYzNzM5NDQ3NWVmZTliMzBmYmZjYzVkNmRkMGE3OWJjYzc2Yw==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZTlkMzhiNDVhMzg5ZDkzMjY0Yjc4YWE4ODUwNDAzYTllZDMzYjM3OGQ0MGYz
|
10
|
+
MTZmZjJjODIxOTk3ZmU4NTNiYzFiOWU1MjlkMzlkMzg4MmZmNzkzZGUzNGUz
|
11
|
+
NjQyYmMyNDQ1MTAwY2ZlYjliY2IxNjc1MmNkOTA0Y2IwNzBjMDU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZmE3MDk5ZDlhYWJkMjhmZDdkODhhMzMzYzJmZTAwYTMwZjA1ZWE4NzEwOGE1
|
14
|
+
NTQxOWFlMjkxMzlhY2NkODIzOWU1YjkyNmM2Yzk2YTg1MjlmODBkZmRmZTgx
|
15
|
+
N2YyOWRmZTUwYzgzYTdkYjVjYjliMTI2YTVmYjBlNzJlMzEwZTE=
|
data/README.md
CHANGED
@@ -67,13 +67,13 @@ with the exception of ```tag``` and ```format``` that were removed.
|
|
67
67
|
|
68
68
|
```
|
69
69
|
# fluent.conf
|
70
|
-
<
|
70
|
+
<source>
|
71
71
|
type event_tail
|
72
72
|
path /var/log/your_app.log
|
73
73
|
pos_file /var/log/your_app.log.pos
|
74
74
|
# disable next line to enable custom time formatting
|
75
75
|
# time_format %d %b %Y %H:%M:%S
|
76
|
-
</
|
76
|
+
</source>
|
77
77
|
```
|
78
78
|
|
79
79
|
## Usage
|
@@ -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-event-tail"
|
7
|
-
gem.version = "0.0.
|
7
|
+
gem.version = "0.0.2"
|
8
8
|
gem.authors = ["Mario Freitas"]
|
9
9
|
gem.email = ["imkira@gmail.com"]
|
10
10
|
gem.description = %q{fluentd input plugin derived from in_tail and inspired by in_forward for reading [tag, time, record] messages from a file}
|
@@ -43,23 +43,31 @@ module Fluent
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def receive_lines(lines)
|
46
|
-
|
47
|
-
|
46
|
+
array = []
|
47
|
+
last_tag = nil
|
48
48
|
lines.each do |line|
|
49
49
|
begin
|
50
50
|
line.chomp!
|
51
|
-
|
52
|
-
|
51
|
+
parse_line(line) do |tag, time, record|
|
52
|
+
if last_tag != tag
|
53
|
+
emit_array(last_tag, array)
|
54
|
+
array = []
|
55
|
+
last_tag = tag
|
56
|
+
end
|
57
|
+
array.push([time, record])
|
53
58
|
end
|
54
59
|
rescue
|
55
60
|
$log.warn line.dump, :error=>$!.to_s
|
56
61
|
$log.debug_backtrace
|
57
62
|
end
|
58
63
|
end
|
64
|
+
emit_array(last_tag, array)
|
65
|
+
end
|
59
66
|
|
60
|
-
|
67
|
+
def emit_array(tag, array)
|
68
|
+
unless tag.nil? || array.empty?
|
61
69
|
begin
|
62
|
-
Engine.
|
70
|
+
Engine.emit_array(tag, array)
|
63
71
|
rescue => e
|
64
72
|
# ignore errors. Engine shows logs and backtraces.
|
65
73
|
end
|
@@ -76,22 +84,20 @@ module Fluent
|
|
76
84
|
entries.each do |e|
|
77
85
|
time = parse_time(e[0])
|
78
86
|
record = e[1]
|
79
|
-
block.call(time, record)
|
87
|
+
block.call(tag, time, record)
|
80
88
|
end
|
81
89
|
|
82
90
|
# [tag, time, record]
|
83
91
|
else
|
84
92
|
time = parse_time(msg[1])
|
85
93
|
record = msg[2]
|
86
|
-
block.call(time, record)
|
94
|
+
block.call(tag, time, record)
|
87
95
|
end
|
88
|
-
|
89
|
-
tag
|
90
96
|
end
|
91
97
|
|
92
98
|
def parse_time(time)
|
93
99
|
if !@time_format.nil? and time.is_a? String
|
94
|
-
Time.strptime(time, @time_format).
|
100
|
+
Time.strptime(time, @time_format).to_f
|
95
101
|
else
|
96
102
|
time = time.to_i
|
97
103
|
time = Engine.now if time == 0
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-event-tail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Mario Freitas
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-01-07 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: :development
|
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
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: fluentd
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -61,27 +56,27 @@ files:
|
|
61
56
|
- test/fluent/plugin/in_event_tail.rb
|
62
57
|
homepage: https://github.com/imkira/fluent-plugin-event-tail
|
63
58
|
licenses: []
|
59
|
+
metadata: {}
|
64
60
|
post_install_message:
|
65
61
|
rdoc_options: []
|
66
62
|
require_paths:
|
67
63
|
- lib
|
68
64
|
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
-
none: false
|
70
65
|
requirements:
|
71
66
|
- - ! '>='
|
72
67
|
- !ruby/object:Gem::Version
|
73
68
|
version: '0'
|
74
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
70
|
requirements:
|
77
71
|
- - ! '>='
|
78
72
|
- !ruby/object:Gem::Version
|
79
73
|
version: '0'
|
80
74
|
requirements: []
|
81
75
|
rubyforge_project:
|
82
|
-
rubygems_version:
|
76
|
+
rubygems_version: 2.0.3
|
83
77
|
signing_key:
|
84
|
-
specification_version:
|
78
|
+
specification_version: 4
|
85
79
|
summary: fluentd input plugin for reading [tag, time, record] messages from a file
|
86
80
|
test_files:
|
87
81
|
- test/fluent/plugin/in_event_tail.rb
|
82
|
+
has_rdoc:
|