fluent-plugin-file-sprintf 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37bd1103d8e73c830d5f878331e356694c4d6216
4
- data.tar.gz: 1268bafc73453b47906180f382a8b2e3b057ca00
3
+ metadata.gz: 9d163ac14dd07900df0593a1f4af13c36c0e8f90
4
+ data.tar.gz: 3dd2e2847944b971e4282f5fd677e078338c164c
5
5
  SHA512:
6
- metadata.gz: 7847583375f65606b5d053818a2b0f08d4f03b1e6fb1d3c2ad290fea676b1d2dac9f0412dbae27c56d511fe0be29da2f0ca1c95ea2f1931a942ab44b55b0bb4a
7
- data.tar.gz: d0c726b43d50aad66a326f448cb3326d2ec39247ae733664930d3bca2b0f1f03c5b5a78a48e76149ec5a8c5017993d669fb5b6ff79dc91d4229f4cdf88cb6e25
6
+ metadata.gz: c81ea6d448be12f508575718c6984e7a745bdeb447ecfd8336fb8795e6e5467f98caa4dba7be9ab6c4d1ae577ff5f7824516b629c6ca79f0dad581a9a88d57f1
7
+ data.tar.gz: e4b654ae0bd9045b9d38a7014136880c934df7772ae1e64c5e83b28c80d80ef98f5319e988108726e3703f40cd9322685c47559052c14c90f75982ebda453f98
data/README.md CHANGED
@@ -27,9 +27,9 @@ format|sprintf format(require)|%s
27
27
  key_names|key names comma separator(require)|ltsv
28
28
  time_format|time value output format(default:%Y-%m-%d %H:%M:%S)|%Y-%m-%d %H:%M:%S
29
29
  file_size_limit|log rotate file size limit byte(default 8388608)|31457280
30
- tag_in_record|tag key in record|true
30
+ include_tag_key|tag key in record|true
31
31
  tag_key_name|tag key name(default:tag)|tag_name
32
- time_in_record|time key in record|true
32
+ include_time_key|time key in record|true
33
33
  time_key_name|time key name(default:time)|timestamp
34
34
 
35
35
  ## key_names reserved words
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-plugin-file-sprintf"
7
- spec.version = "0.0.2"
7
+ spec.version = "0.0.3"
8
8
  spec.authors = ["Hiroshi Toyama"]
9
9
  spec.email = ["toyama0919@gmail.com"]
10
10
  spec.description = %q{sprintf output file plugin for Fluentd.}
@@ -7,9 +7,9 @@ module Fluent
7
7
  config_param :file_size_limit, :integer ,:default => 8388608
8
8
  config_param :format, :string
9
9
  config_param :compress, :bool, :default => true
10
- config_param :tag_in_record, :bool, :default => false
10
+ config_param :include_tag_key, :bool, :default => false
11
11
  config_param :tag_key_name, :string, :default => "tag"
12
- config_param :time_in_record, :bool, :default => false
12
+ config_param :include_time_key, :bool, :default => false
13
13
  config_param :time_key_name, :string, :default => "time"
14
14
  config_param :key_names, :string
15
15
  config_param :time_format, :string, :default => "%Y-%m-%d %H:%M:%S"
@@ -54,10 +54,10 @@ module Fluent
54
54
  end
55
55
 
56
56
  def format(tag, time, record)
57
- if @tag_in_record
57
+ if @include_tag_key
58
58
  record[@tag_key_name] = tag
59
59
  end
60
- if @time_in_record
60
+ if @include_time_key
61
61
  record[@time_key_name] = Time.at(time).strftime(@time_format)
62
62
  end
63
63
  [tag, time, record].to_msgpack
@@ -75,14 +75,15 @@ module Fluent
75
75
  }
76
76
 
77
77
  if file_size > @file_size_limit
78
+ output_path = @path + "." + "#{Time.now.strftime('%Y%m%d%H%M%S')}"
78
79
  if @compress
79
- Zlib::GzipWriter.open(@path + "." + "#{Fluent::Engine.now}" + ".gz") do |gz|
80
+ Zlib::GzipWriter.open(output_path + ".gz") do |gz|
80
81
  gz.mtime = File.mtime(filepath)
81
82
  gz.orig_name = filepath
82
83
  gz.write IO.binread(filepath)
83
84
  end
84
85
  else
85
- FileUtils.cp filepath, @path + "." + "#{Fluent::Engine.now}"
86
+ FileUtils.cp filepath, output_path
86
87
  end
87
88
  FileUtils.remove_file(filepath, force = true)
88
89
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-file-sprintf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroshi Toyama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-13 00:00:00.000000000 Z
11
+ date: 2014-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ltsv
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  version: '0'
87
87
  requirements: []
88
88
  rubyforge_project:
89
- rubygems_version: 2.2.0
89
+ rubygems_version: 2.2.0.rc.1
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: sprintf output file plugin for Fluentd.