fluent-plugin-file-alternative 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "fluent-plugin-file-alternative"
5
- gem.version = "0.1.1"
5
+ gem.version = "0.1.2"
6
6
 
7
7
  gem.authors = ["TAGOMORI Satoshi"]
8
8
  gem.email = ["tagomoris@gmail.com"]
@@ -215,6 +215,8 @@ class Fluent::FileAlternativeOutput < Fluent::TimeSlicedOutput
215
215
 
216
216
  config_param :path, :string # /path/pattern/to/hdfs/file can use %Y %m %d %H %M %S
217
217
 
218
+ config_param :time_format, :string, :default => nil
219
+
218
220
  config_param :compress, :default => nil do |val|
219
221
  c = SUPPORTED_COMPRESS[val.to_sym]
220
222
  unless c
@@ -270,6 +272,8 @@ class Fluent::FileAlternativeOutput < Fluent::TimeSlicedOutput
270
272
  unless @path.index('/') == 0
271
273
  raise Fluent::ConfigError, "Path on filesystem MUST starts with '/', but '#{@path}'"
272
274
  end
275
+
276
+ @timef = Fluent::TimeFormatter.new(@time_format, @localtime)
273
277
  end
274
278
 
275
279
  def start
@@ -50,6 +50,17 @@ class FileAlternativeOutputTest < Test::Unit::TestCase
50
50
  d1.expect_format %[2011-01-02T13:14:15Z\ttest\t{"a":2}\n]
51
51
  d1.run
52
52
 
53
+ dx = create_driver(CONFIG + %[
54
+ time_format %Y-%m-%d %H-%M-%S
55
+ ])
56
+
57
+ time = Time.parse("2011-01-02 13:14:15 UTC").to_i
58
+ dx.emit({"a"=>1}, time)
59
+ dx.emit({"a"=>2}, time)
60
+ dx.expect_format %[2011-01-02 13-14-15\ttest\t{"a":1}\n]
61
+ dx.expect_format %[2011-01-02 13-14-15\ttest\t{"a":2}\n]
62
+ dx.run
63
+
53
64
  d2 = create_driver %[
54
65
  path #{TMP_DIR}/accesslog.%Y-%m-%d-%H-%M-%S
55
66
  output_include_time false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-file-alternative
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
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: 2012-04-09 00:00:00.000000000 Z
12
+ date: 2012-04-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd