fluent-plugin-file-sprintf 0.0.6 → 0.0.7

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: 2e4c794378a0121131dbd3723bb922833cecae2c
4
- data.tar.gz: 36c2bdcb67c8fbd0af4e74697fc04b5c6602297a
3
+ metadata.gz: ca7cdc6af464e12580120b8117fd6d33b83d4d8c
4
+ data.tar.gz: a253a144e1c887769435421d0904128c26874006
5
5
  SHA512:
6
- metadata.gz: 4935b43e8919108ed0db80c3716f30fc1a4bd8de615baf0c26b1173bdaefdf0bf025fc89cf2c4ad562573bd4b1eb9f52539245fac98f766e810a099c04be97a6
7
- data.tar.gz: 9387b6a0fb6ed47c88fd05ab6eea5f55469d0298450570eee9413b69e631c0223a01a5bb3cee39b8173b54beddddf6f16f151a96ba028193cca39a6cce34de42
6
+ metadata.gz: d7c8ab9e87428ab9352967f9dd39824561fff2a99bdfdb4f3bea5b21a50d2b689ec2be2bd88e22dc2e9567a4e573c9d2421412417c82245fc4740be00ff8aa8f
7
+ data.tar.gz: 219d9c997558176e34d68e94c1b6897d3e8714c5194c734bd695f744ac378529a266f601bb6ebae71be69490898e40f46a3aa7eb9c9dfdaf8316854085721c7b
data/.gitignore CHANGED
@@ -2,5 +2,7 @@ Gemfile.lock
2
2
  nbproject/
3
3
  .project
4
4
  *.gem
5
+ *.log
5
6
  pkg
6
7
  test/
8
+ tmp/
@@ -0,0 +1,3 @@
1
+
2
+ UnusedBlockArgument:
3
+ Enabled: false
@@ -0,0 +1,6 @@
1
+ guard :rubocop, all_on_start: false, cli: ['-a'], notification: true do
2
+ watch(%r{.+\.rb$})
3
+ watch(%r{.+\.rake$})
4
+ watch('Rakefile')
5
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
6
+ end
data/README.md CHANGED
@@ -110,6 +110,22 @@ json|output json string
110
110
  key_names json
111
111
  </store>
112
112
 
113
+ ## rotate with loglotate.d exsample
114
+
115
+ ```bash:/etc/logrotate.d/sprintf
116
+ /var/log/webapp.log {
117
+ daily
118
+ rotate 30
119
+ create 640 td-agent td-agent
120
+ missingok
121
+ notifempty
122
+ sharedscripts
123
+ postrotate
124
+ pid=/var/run/td-agent/td-agent.pid
125
+ test -s $pid && kill -USR1 "$(cat $pid)"
126
+ endscript
127
+ }
128
+ ```
113
129
 
114
130
  ## Contributing
115
131
 
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
- require "bundler"
2
- require "bundler/gem_tasks"
1
+ require 'bundler'
2
+ require 'bundler/gem_tasks'
3
3
  Bundler::GemHelper.install_tasks
4
4
  require 'rake/testtask'
5
5
 
@@ -9,9 +9,13 @@ Rake::TestTask.new(:test) do |test|
9
9
  test.verbose = true
10
10
  end
11
11
 
12
- task :coverage do |t|
12
+ task :coverage do |_t|
13
13
  ENV['COVERAGE'] = '1'
14
- Rake::Task["test"].invoke
14
+ Rake::Task['test'].invoke
15
15
  end
16
16
 
17
- task :default => [:build]
17
+ task :run do |_t|
18
+ sh 'fluentd -p lib/fluent/plugin -c sample/fluent.conf'
19
+ end
20
+
21
+ task default: [:build]
@@ -3,21 +3,25 @@ lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = "fluent-plugin-file-sprintf"
7
- spec.version = "0.0.6"
8
- spec.authors = ["Hiroshi Toyama"]
9
- spec.email = ["toyama0919@gmail.com"]
10
- spec.description = %q{sprintf output file plugin for Fluentd.}
6
+ spec.name = 'fluent-plugin-file-sprintf'
7
+ spec.version = '0.0.7'
8
+ spec.authors = ['Hiroshi Toyama']
9
+ spec.email = ['toyama0919@gmail.com']
10
+ spec.description = %q(sprintf output file plugin for Fluentd.)
11
11
  spec.summary = spec.description
12
- spec.homepage = "https://github.com/toyama0919/fluent-plugin-file-sprintf/"
13
- spec.license = "MIT"
12
+ spec.homepage = 'https://github.com/toyama0919/fluent-plugin-file-sprintf/'
13
+ spec.license = 'MIT'
14
14
 
15
- spec.files = `git ls-files`.split($/)
15
+ spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
16
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ["lib"]
18
+ spec.require_paths = ['lib']
19
19
 
20
- spec.add_runtime_dependency "ltsv"
21
- spec.add_development_dependency "bundler", "~> 1.3"
22
- spec.add_development_dependency "rake"
20
+ spec.add_runtime_dependency 'ltsv'
21
+ spec.add_development_dependency 'bundler', '~> 1.3'
22
+ spec.add_development_dependency 'rake'
23
+ spec.add_development_dependency 'guard'
24
+ spec.add_development_dependency 'guard-shell'
25
+ spec.add_development_dependency 'guard-rubocop'
26
+ spec.add_development_dependency 'fluentd'
23
27
  end
@@ -5,14 +5,14 @@ module Fluent
5
5
 
6
6
  config_param :path, :string
7
7
  config_param :format, :string
8
- config_param :compress, :bool, default: true
8
+ config_param :compress, :bool, default: false
9
9
  config_param :include_tag_key, :bool, default: false
10
10
  config_param :tag_key_name, :string, default: 'tag'
11
11
  config_param :include_time_key, :bool, default: false
12
12
  config_param :time_key_name, :string, default: 'time'
13
13
  config_param :key_names, :string
14
14
  config_param :time_format, :string, default: '%Y-%m-%d %H:%M:%S'
15
- config_param :rotate, :bool, default: true
15
+ config_param :rotate, :bool, default: false
16
16
  config_param :rotate_format, :string, default: '%Y%m%d'
17
17
  config_param :file_prefix_key, :string, default: 'Time.at(time).strftime(@rotate_format)'
18
18
 
@@ -85,7 +85,7 @@ module Fluent
85
85
 
86
86
  filename_hash = {}
87
87
  set.each do|prefix|
88
- filename_hash[prefix] = File.open(@path + '.' + prefix, 'a')
88
+ filename_hash[prefix] = File.open(@path + '.' + prefix, 'ab')
89
89
  end
90
90
 
91
91
  chunk.msgpack_each do |tag, time, record|
@@ -100,7 +100,7 @@ module Fluent
100
100
  end
101
101
 
102
102
  def write_file_no_rotate(chunk)
103
- file = File.open(@path, 'a')
103
+ file = File.open(@path, 'ab')
104
104
  chunk.msgpack_each do |tag, time, record|
105
105
  result = eval(@eval_string)
106
106
  file.puts result
@@ -0,0 +1,52 @@
1
+
2
+ <source>
3
+ type forward
4
+ port 24224
5
+ </source>
6
+
7
+ <match ltsv.sprintf>
8
+ type file_sprintf
9
+ format %s
10
+ key_names ltsv
11
+ path tmp/ltsv.log
12
+ buffer_path tmp/buffer.ltsv.*.log
13
+ flush_interval 10s
14
+ </match>
15
+
16
+ <match json.sprintf>
17
+ type file_sprintf
18
+ format %s
19
+ key_names json
20
+ path tmp/json.log
21
+ buffer_path tmp/buffer.json.*.log
22
+ flush_interval 10s
23
+ </match>
24
+
25
+ <match custom_json.sprintf>
26
+ type file_sprintf
27
+ buffer_path tmp/custom_json.*.log
28
+ path tmp/custom_json.log
29
+ format {"method":"%s","agent":"%s","referer":"%s","path":"%s","host":"%s","time":"%s","tag":"%s"}
30
+ key_names method,agent,referer,path,host,time,tag
31
+ flush_interval 10s
32
+ </match>
33
+
34
+ <match tsv.sprintf>
35
+ type file_sprintf
36
+ buffer_path tmp/buffer/tsv.*.log
37
+ path tmp/tsv.log
38
+ format %s\t%s\t%s\t%s\t%s\t%s\t%s
39
+ key_names method,agent,referer,path,host,time,tag
40
+ flush_interval 10s
41
+ </match>
42
+
43
+ <match custom_ltsv.sprintf>
44
+ type file_sprintf
45
+ buffer_path tmp/buffer/custom_ltsv.*.log
46
+ path tmp/custom_ltsv.log
47
+ format time:%s\ttag:%s\tmessage:%s
48
+ key_names time,tag,message
49
+ flush_interval 10s
50
+ include_time_key true
51
+ </match>
52
+
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.6
4
+ version: 0.0.7
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-03-12 00:00:00.000000000 Z
11
+ date: 2016-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ltsv
@@ -52,6 +52,62 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: guard
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: guard-shell
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard-rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: fluentd
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
55
111
  description: sprintf output file plugin for Fluentd.
56
112
  email:
57
113
  - toyama0919@gmail.com
@@ -60,12 +116,16 @@ extensions: []
60
116
  extra_rdoc_files: []
61
117
  files:
62
118
  - ".gitignore"
119
+ - ".rubocop.yml"
63
120
  - Gemfile
121
+ - Guardfile
64
122
  - LICENSE.txt
65
123
  - README.md
66
124
  - Rakefile
67
125
  - fluent-plugin-file-sprintf.gemspec
68
126
  - lib/fluent/plugin/out_file_sprintf.rb
127
+ - sample/fluent.conf
128
+ - tmp/.keep
69
129
  homepage: https://github.com/toyama0919/fluent-plugin-file-sprintf/
70
130
  licenses:
71
131
  - MIT
@@ -86,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
146
  version: '0'
87
147
  requirements: []
88
148
  rubyforge_project:
89
- rubygems_version: 2.2.2
149
+ rubygems_version: 2.4.2
90
150
  signing_key:
91
151
  specification_version: 4
92
152
  summary: sprintf output file plugin for Fluentd.