fluent-plugin-s3 0.3.3 → 0.3.4

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.
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 1.9.2
5
+ - 1.9.3
6
+ - 2.0.0
7
+ - rbx-19mode
8
+
9
+ branches:
10
+ only:
11
+ - master
12
+
13
+ script: bundle exec rake test
data/ChangeLog CHANGED
@@ -1,3 +1,9 @@
1
+ Release 0.3.4 - 2013/07/31
2
+
3
+ * Add dynamic path slicing by time formatted string
4
+ https://github.com/fluent/fluent-plugin-s3/pull/24
5
+
6
+
1
7
  Release 0.3.3 - 2013/06/18
2
8
 
3
9
  * Fix require bug on case-sensitive environment
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.3
1
+ 0.3.4
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.name = "fluent-plugin-s3"
6
- gem.description = "Amazon S3 output plugin for Fluent event collector"
6
+ gem.description = "Amazon S3 output plugin for Fluentd event collector"
7
7
  gem.homepage = "https://github.com/fluent/fluent-plugin-s3"
8
8
  gem.summary = gem.description
9
9
  gem.version = File.read("VERSION").strip
@@ -77,6 +77,17 @@ class S3Output < Fluent::TimeSlicedOutput
77
77
  end
78
78
 
79
79
  @timef = TimeFormatter.new(@time_format, @localtime)
80
+
81
+ if @localtime
82
+ @path_slicer = Proc.new {|path|
83
+ Time.now.strftime(path)
84
+ }
85
+ else
86
+ @path_slicer = Proc.new {|path|
87
+ Time.now.utc.strftime(path)
88
+ }
89
+ end
90
+
80
91
  end
81
92
 
82
93
  def start
@@ -121,8 +132,9 @@ class S3Output < Fluent::TimeSlicedOutput
121
132
  i = 0
122
133
 
123
134
  begin
135
+ path = @path_slicer.call(@path)
124
136
  values_for_s3_object_key = {
125
- "path" => @path,
137
+ "path" => path,
126
138
  "time_slice" => chunk.key,
127
139
  "file_extension" => @ext,
128
140
  "index" => i
data/test/out_s3.rb CHANGED
@@ -70,6 +70,25 @@ class S3OutputTest < Test::Unit::TestCase
70
70
  assert(e.is_a?(Fluent::ConfigError))
71
71
  end
72
72
 
73
+ def test_path_slicing
74
+ config = CONFIG.clone.gsub(/path\slog/, "path log/%Y/%m/%d")
75
+ d = create_driver(config)
76
+ path_slicer = d.instance.instance_variable_get(:@path_slicer)
77
+ path = d.instance.instance_variable_get(:@path)
78
+ slice = path_slicer.call(path)
79
+ assert_equal slice, Time.now.strftime("log/%Y/%m/%d")
80
+ end
81
+
82
+ def test_path_slicing_utc
83
+ config = CONFIG.clone.gsub(/path\slog/, "path log/%Y/%m/%d")
84
+ config << "\nutc\n"
85
+ d = create_driver(config)
86
+ path_slicer = d.instance.instance_variable_get(:@path_slicer)
87
+ path = d.instance.instance_variable_get(:@path)
88
+ slice = path_slicer.call(path)
89
+ assert_equal slice, Time.now.utc.strftime("log/%Y/%m/%d")
90
+ end
91
+
73
92
  def test_format
74
93
  d = create_driver
75
94
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-18 00:00:00.000000000 Z
12
+ date: 2013-07-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd
@@ -107,12 +107,13 @@ dependencies:
107
107
  - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
109
  version: 1.2.0
110
- description: Amazon S3 output plugin for Fluent event collector
110
+ description: Amazon S3 output plugin for Fluentd event collector
111
111
  email: frsyuki@gmail.com
112
112
  executables: []
113
113
  extensions: []
114
114
  extra_rdoc_files: []
115
115
  files:
116
+ - .travis.yml
116
117
  - AUTHORS
117
118
  - ChangeLog
118
119
  - Gemfile
@@ -136,7 +137,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
136
137
  version: '0'
137
138
  segments:
138
139
  - 0
139
- hash: -3746525337841491520
140
+ hash: 586296874409098593
140
141
  required_rubygems_version: !ruby/object:Gem::Requirement
141
142
  none: false
142
143
  requirements:
@@ -145,12 +146,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
146
  version: '0'
146
147
  segments:
147
148
  - 0
148
- hash: -3746525337841491520
149
+ hash: 586296874409098593
149
150
  requirements: []
150
151
  rubyforge_project:
151
152
  rubygems_version: 1.8.23
152
153
  signing_key:
153
154
  specification_version: 3
154
- summary: Amazon S3 output plugin for Fluent event collector
155
+ summary: Amazon S3 output plugin for Fluentd event collector
155
156
  test_files:
156
157
  - test/out_s3.rb