dummy_log_generator 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +29 -4
- data/bin/dummy_log_generator_simple +1 -1
- data/lib/dummy_log_generator/cli.rb +10 -6
- data/lib/dummy_log_generator/version.rb +1 -1
- data/lib/dummy_log_generator/worker.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 763e3b1f88736bd01458802295b72b701a55b6f5
|
4
|
+
data.tar.gz: 7a4d73d333d054750f71f99ba5ee0692a5deac3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21337c2b2f2b18d9d981d66cf1b0b8125dfaadee0860376b546e46fd9a3f5fbc84747b8176318429b934d8cc157fc54a270e335f03eee7a66cf1e65daf29ae5e
|
7
|
+
data.tar.gz: 3de501d065779d73c4253ee831f38f98198eb22aefb518421bc09efaafc35063655bc232becda1eca80f4666035615623be94d9bc67735b5441c26a0a477f568
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -43,7 +43,7 @@ Create a configuration file. A sample configuration is as follows:
|
|
43
43
|
```ruby
|
44
44
|
# dummy_log_generator.conf
|
45
45
|
configure 'sample' do
|
46
|
-
output dummy.log
|
46
|
+
output "dummy.log"
|
47
47
|
rate 500
|
48
48
|
delimiter "\t"
|
49
49
|
labeled true
|
@@ -71,6 +71,27 @@ id:0423 time:[2013-11-19 02:34:58] level:DEBUG method:GET uri:/api/v1/people
|
|
71
71
|
id:0424 time:[2013-11-19 02:34:58] level:WARN method:POST uri:/api/v1/textdata reqtime:2.930590441869852 foobar:XEZ5bQsh
|
72
72
|
```
|
73
73
|
|
74
|
+
### CLI Options
|
75
|
+
|
76
|
+
```
|
77
|
+
$ dummy_log_generator help start
|
78
|
+
Usage:
|
79
|
+
dummy_log_generator start
|
80
|
+
|
81
|
+
Options:
|
82
|
+
-c, [--config=CONFIG] # Config file
|
83
|
+
# Default: dummy_log_generator.conf
|
84
|
+
-r, [--rate=N] # Number of generating messages per second
|
85
|
+
-o, [--output=OUTPUT] # Output file
|
86
|
+
-m, [--message=MESSAGE] # Output message
|
87
|
+
-d, [--daemonize] # Daemonize. Stop with `dummy_log_generator stop`
|
88
|
+
-w, [--workers=N] # Number of parallels
|
89
|
+
[--worker-type=WORKER_TYPE]
|
90
|
+
# Default: process
|
91
|
+
-p, [--pid-path=PID_PATH]
|
92
|
+
# Default: dummy_log_generator.pid
|
93
|
+
```
|
94
|
+
|
74
95
|
### Configuration Parameters
|
75
96
|
|
76
97
|
Following parameters in the configuration file are available:
|
@@ -97,11 +118,11 @@ Following parameters in the configuration file are available:
|
|
97
118
|
|
98
119
|
* field
|
99
120
|
|
100
|
-
Define data fields to generate. `message` and `
|
121
|
+
Define data fields to generate. `message` and `input` options are ignored.
|
101
122
|
|
102
123
|
* input
|
103
124
|
|
104
|
-
Use this if you want to write messages by reading lines of an input file in rotation. `
|
125
|
+
Use this if you want to write messages by reading lines of an input file in rotation. `message` is ignored.
|
105
126
|
|
106
127
|
* message
|
107
128
|
|
@@ -189,7 +210,7 @@ Usage:
|
|
189
210
|
dummy_log_generator_simple
|
190
211
|
|
191
212
|
Options:
|
192
|
-
[--sync] #
|
213
|
+
[--sync] # Set `IO#sync=true`
|
193
214
|
-s, [--second=N] # Duration of running in second
|
194
215
|
# Default: 1
|
195
216
|
-p, [--parallel=N] # Number of processes to run in parallel
|
@@ -233,6 +254,10 @@ Options:
|
|
233
254
|
|
234
255
|
There is a [fluent-plugin-dummydata-producer](https://github.com/tagomoris/fluent-plugin-dummydata-producer), but I wanted to output dummy data to a log file, and I wanted a standalone tool.
|
235
256
|
|
257
|
+
## Related Articles
|
258
|
+
|
259
|
+
* [Fluentd のベンチマークテストに使える dummy_log_generator](http://qiita.com/sonots/items/750da77a18e62852a02f)
|
260
|
+
|
236
261
|
## ToDO
|
237
262
|
|
238
263
|
1. write tests
|
@@ -5,7 +5,7 @@ module DummyLogGeneratorSimple
|
|
5
5
|
class CLI < Thor
|
6
6
|
default_command :start
|
7
7
|
desc "start", "Start a dummy_log_generator"
|
8
|
-
option :sync, :type => :boolean, :desc => '
|
8
|
+
option :sync, :type => :boolean, :desc => 'Set `IO#sync=true`'
|
9
9
|
option :second, :aliases => ["-s"], :type => :numeric, :default => 1, :desc => 'Duration of running in second'
|
10
10
|
option :parallel, :aliases => ["-p"], :type => :numeric, :default => 1, :desc => 'Number of processes to run in parallel'
|
11
11
|
option :output, :aliases => ["-o"], :type => :string, :default => 'dummy.log', :desc => 'Output file'
|
@@ -14,12 +14,14 @@ module DummyLogGenerator
|
|
14
14
|
end
|
15
15
|
|
16
16
|
desc "start", "Start a dummy_log_generator"
|
17
|
-
option :config,
|
18
|
-
option :rate,
|
17
|
+
option :config, :aliases => ["-c"], :type => :string, :default => 'dummy_log_generator.conf', :desc => 'Config file'
|
18
|
+
option :rate, :aliases => ["-r"], :type => :numeric, :desc => 'Number of generating messages per second'
|
19
|
+
option :output, :aliases => ["-o"], :type => :string, :desc => 'Output file'
|
20
|
+
option :message, :aliases => ["-m"], :type => :string, :desc => 'Output message'
|
19
21
|
# options for serverengine
|
20
|
-
option :daemonize,
|
21
|
-
option :workers,
|
22
|
-
option :worker_type,
|
22
|
+
option :daemonize, :aliases => ["-d"], :type => :boolean, :desc => 'Daemonize. Stop with `dummy_log_generator stop`'
|
23
|
+
option :workers, :aliases => ["-w"], :type => :numeric, :desc => 'Number of parallels'
|
24
|
+
option :worker_type, :type => :string, :default => 'process'
|
23
25
|
def start
|
24
26
|
@options = @options.dup # avoid frozen
|
25
27
|
dsl =
|
@@ -29,7 +31,9 @@ module DummyLogGenerator
|
|
29
31
|
DummyLogGenerator::Dsl.new
|
30
32
|
end
|
31
33
|
@options[:setting] = dsl.setting
|
32
|
-
|
34
|
+
dsl.setting.rate = options[:rate] if options[:rate]
|
35
|
+
dsl.setting.output = options[:output] if options[:output]
|
36
|
+
dsl.setting.message = options[:message] if options[:message]
|
33
37
|
# options for serverengine
|
34
38
|
@options[:workers] ||= dsl.setting.workers
|
35
39
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dummy_log_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sonots
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|