fluent-plugin-cloudwatch-logs 0.4.0 → 0.4.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: c0dc91635c59f4a51c34d7356c8fcb014ed9bfbb
4
- data.tar.gz: 2ce500d9be9c5af93eb7d3d952408ddb10e0458a
3
+ metadata.gz: 9e629c8fa1e69f1fc25b63be72d3891bed73eb92
4
+ data.tar.gz: cf4b8011d1c17117e09e00c421540717fb02064a
5
5
  SHA512:
6
- metadata.gz: e7a2371942b64cccf0ac4c0b117fe8657e8a1f98fd11f8b27ba715dd84d24de1a76e1d2795daac079c6b93cba744ca34b295af2c05b8c83611440d0d543333c5
7
- data.tar.gz: 8ae207ac8b8b2db382ed1aebe4653f2d662301169a708dad5820014e4c1b3ec2eea0795615d1f70e362d561ee9dd0a2998ec7c27bcf9719846cf7b99ffe839d5
6
+ metadata.gz: 56f19ed188cfae7f5672a2b3ac425c5c03ff43a454bdfa4a920df6ca368871b79c646e55dd8429340735c91c802b1740d74982430bc0dba084bf4df90b292db6
7
+ data.tar.gz: 05d706f093a4d4815b510df65730e85cabb5915adc66db0b7513596d936f05ad10651d2d8c3687f7da8125ff860ac719f1cd7c7ac4d03339ad968ab7127a175d
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ["lib"]
19
19
 
20
20
  spec.add_dependency 'fluentd'
21
- spec.add_dependency 'aws-sdk-core', '>= 2.0.7'
21
+ spec.add_dependency 'aws-sdk-core', '~> 2.0'
22
22
  spec.add_dependency 'fluent-mixin-config-placeholders', '>= 0.2.0'
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.6"
@@ -2,7 +2,7 @@ module Fluent
2
2
  module Plugin
3
3
  module Cloudwatch
4
4
  module Logs
5
- VERSION = "0.4.0"
5
+ VERSION = "0.4.1"
6
6
  end
7
7
  end
8
8
  end
@@ -1,4 +1,5 @@
1
1
  require 'fluent/input'
2
+ require 'fluent/parser'
2
3
 
3
4
  module Fluent
4
5
  require 'fluent/mixin/config_placeholders'
@@ -71,20 +72,23 @@ module Fluent
71
72
  private
72
73
  def configure_parser(conf)
73
74
  if conf['format']
74
- @parser = TextParser.new
75
+ @parser = Fluent::TextParser.new
75
76
  @parser.configure(conf)
76
77
  end
77
78
  end
78
79
 
79
- def next_token
80
- return nil unless File.exist?(@state_file)
81
- File.read(@state_file).chomp
80
+ def state_file_for(log_stream_name)
81
+ return "#{@state_file}_#{log_stream_name.gsub(File::SEPARATOR, '-')}" if log_stream_name
82
+ return @state_file
83
+ end
84
+
85
+ def next_token(log_stream_name)
86
+ return nil unless File.exist?(state_file_for(log_stream_name))
87
+ File.read(state_file_for(log_stream_name)).chomp
82
88
  end
83
89
 
84
90
  def store_next_token(token, log_stream_name = nil)
85
- state_file = @state_file
86
- state_file = "#{@state_file}_#{log_stream_name}" if log_stream_name
87
- open(state_file, 'w') do |f|
91
+ open(state_file_for(log_stream_name), 'w') do |f|
88
92
  f.write token
89
93
  end
90
94
  end
@@ -102,13 +106,13 @@ module Fluent
102
106
  log_stream_name = log_stram.log_stream_name
103
107
  events = get_events(log_stream_name)
104
108
  events.each do |event|
105
- emit(event)
109
+ emit(log_stream_name, event)
106
110
  end
107
111
  end
108
112
  else
109
113
  events = get_events(@log_stream_name)
110
114
  events.each do |event|
111
- emit(event)
115
+ emit(log_stream_name, event)
112
116
  end
113
117
  end
114
118
  end
@@ -116,7 +120,7 @@ module Fluent
116
120
  end
117
121
  end
118
122
 
119
- def emit(event)
123
+ def emit(stream, event)
120
124
  if @parser
121
125
  record = @parser.parse(event.message)
122
126
  router.emit(@tag, record[0], record[1])
@@ -132,7 +136,7 @@ module Fluent
132
136
  log_group_name: @log_group_name,
133
137
  log_stream_name: log_stream_name
134
138
  }
135
- request[:next_token] = next_token if next_token
139
+ request[:next_token] = next_token(log_stream_name) if next_token(log_stream_name)
136
140
  response = @logs.get_log_events(request)
137
141
  store_next_token(response.next_forward_token, log_stream_name)
138
142
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-cloudwatch-logs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-14 00:00:00.000000000 Z
11
+ date: 2017-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: aws-sdk-core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.0.7
33
+ version: '2.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.0.7
40
+ version: '2.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: fluent-mixin-config-placeholders
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  version: '0'
150
150
  requirements: []
151
151
  rubyforge_project:
152
- rubygems_version: 2.6.8
152
+ rubygems_version: 2.6.11
153
153
  signing_key:
154
154
  specification_version: 4
155
155
  summary: CloudWatch Logs Plugin for Fluentd