fluent-plugin-file-sprintf 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5a4f17b7e16b09210c8e077f49a1a0e3b2b2944
4
- data.tar.gz: 8722818ad5766d16dd4cb05fa9446e916fa28d57
3
+ metadata.gz: 37bd1103d8e73c830d5f878331e356694c4d6216
4
+ data.tar.gz: 1268bafc73453b47906180f382a8b2e3b057ca00
5
5
  SHA512:
6
- metadata.gz: 9873101ad62256ed8adbf48f21bc71de2e897359830e741d51359dc525ff9be5a14d044b0d09c4e9d25468ccd89db531e6ef91a5ae266a0af7012bef53a553c6
7
- data.tar.gz: 50155220f312fa1f8de018a7ff43bb579195fb77b10b43c83c564e55264f32060155b865703fc9f30eedaa8c095507c794adf7df0cc1aed92d7c753a38544af7
6
+ metadata.gz: 7847583375f65606b5d053818a2b0f08d4f03b1e6fb1d3c2ad290fea676b1d2dac9f0412dbae27c56d511fe0be29da2f0ca1c95ea2f1931a942ab44b55b0bb4a
7
+ data.tar.gz: d0c726b43d50aad66a326f448cb3326d2ec39247ae733664930d3bca2b0f1f03c5b5a78a48e76149ec5a8c5017993d669fb5b6ff79dc91d4229f4cdf88cb6e25
data/README.md CHANGED
@@ -16,7 +16,6 @@ sprintf output file plugin for Fluentd.
16
16
 
17
17
  gem install fluent-plugin-file-sprintf
18
18
 
19
-
20
19
  ## parameter
21
20
 
22
21
  param | value|exsample
@@ -28,6 +27,10 @@ format|sprintf format(require)|%s
28
27
  key_names|key names comma separator(require)|ltsv
29
28
  time_format|time value output format(default:%Y-%m-%d %H:%M:%S)|%Y-%m-%d %H:%M:%S
30
29
  file_size_limit|log rotate file size limit byte(default 8388608)|31457280
30
+ tag_in_record|tag key in record|true
31
+ tag_key_name|tag key name(default:tag)|tag_name
32
+ time_in_record|time key in record|true
33
+ time_key_name|time key name(default:time)|timestamp
31
34
 
32
35
  ## key_names reserved words
33
36
 
@@ -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.1"
7
+ spec.version = "0.0.2"
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,6 +7,10 @@ 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
11
+ config_param :tag_key_name, :string, :default => "tag"
12
+ config_param :time_in_record, :bool, :default => false
13
+ config_param :time_key_name, :string, :default => "time"
10
14
  config_param :key_names, :string
11
15
  config_param :time_format, :string, :default => "%Y-%m-%d %H:%M:%S"
12
16
 
@@ -30,7 +34,7 @@ module Fluent
30
34
  key = key.strip
31
35
  result = ""
32
36
  if key == 'time'
33
- result = "Time.at(time).strftime('#{time_format}')"
37
+ result = "Time.at(time).strftime('#{@time_format}')"
34
38
  elsif key == 'tag'
35
39
  result = 'tag'
36
40
  elsif key == 'ltsv'
@@ -50,6 +54,12 @@ module Fluent
50
54
  end
51
55
 
52
56
  def format(tag, time, record)
57
+ if @tag_in_record
58
+ record[@tag_key_name] = tag
59
+ end
60
+ if @time_in_record
61
+ record[@time_key_name] = Time.at(time).strftime(@time_format)
62
+ end
53
63
  [tag, time, record].to_msgpack
54
64
  end
55
65
 
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.1
4
+ version: 0.0.2
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-12 00:00:00.000000000 Z
11
+ date: 2014-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ltsv