logstash-input-faker 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logstash/inputs/faker.rb +6 -6
- data/logstash-input-faker.gemspec +1 -1
- data/spec/inputs/faker_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0b0612f2fe0485a77d7f728963ab6935a145aff
|
4
|
+
data.tar.gz: 3929513729b77e4633620b2c53d7a502a08e1401
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f7bf726acded7384120aafbf3f89ba6e99ee854d1620a3809ba74dc051dada14fc52809d8b86a234fdb8b8e56404484a6b2dfc7e608c1fd94bb71fc33b45aaf
|
7
|
+
data.tar.gz: 5cdf793902a797cc8b7d8c9a5f1496075c5e650c0ab97ee8047ea1db5d4c2205b62700e9c4ce269635d26a9d4d143eaa8b498196ba54a8d9bd3b092b5d961a60
|
@@ -16,7 +16,7 @@ I18n.reload!
|
|
16
16
|
# modules and method calls from the Faker gem library seen at
|
17
17
|
# https://github.com/stympy/faker/
|
18
18
|
# ===================================================================
|
19
|
-
# Example:
|
19
|
+
# Example:
|
20
20
|
# [source, ruby]
|
21
21
|
# input {
|
22
22
|
# faker {
|
@@ -38,11 +38,11 @@ class LogStash::Inputs::Faker < LogStash::Inputs::Base
|
|
38
38
|
|
39
39
|
|
40
40
|
# Similar to LogStash::Inputs::Base.add_field define a hash
|
41
|
-
# where the value is a Faker module and method call
|
41
|
+
# where the value is a Faker module and method call
|
42
42
|
# ex: Name.first_name
|
43
43
|
config :add_faker_field, :validate => :hash, :default => {}
|
44
44
|
|
45
|
-
# Add a splitable field. Currently only supports defining a
|
45
|
+
# Add a splitable field. Currently only supports defining a
|
46
46
|
# single field that will be used for generating sub-events
|
47
47
|
config :splitable_field, :validate => :string, :default => nil
|
48
48
|
|
@@ -55,7 +55,7 @@ class LogStash::Inputs::Faker < LogStash::Inputs::Base
|
|
55
55
|
config :add_splitable_faker_field, :validate => :hash, :default => {}
|
56
56
|
|
57
57
|
# define the number of entries into the array of the splitable field
|
58
|
-
# When set to 0 a random number will be used within 1-100 as the
|
58
|
+
# When set to 0 a random number will be used within 1-100 as the
|
59
59
|
# splitable field count
|
60
60
|
config :splitable_field_count, :validate => :number, default: 0
|
61
61
|
|
@@ -111,10 +111,10 @@ class LogStash::Inputs::Faker < LogStash::Inputs::Base
|
|
111
111
|
@splitable_field_count.times do
|
112
112
|
new_event = LogStash::Event.new()
|
113
113
|
@add_splitable_faker_field.each do |field, faker_string|
|
114
|
-
new_event.set(field, Faker.class_eval(faker_string))
|
114
|
+
new_event.set(field, Faker.class_eval(event.sprintf(faker_string)))
|
115
115
|
end
|
116
116
|
@add_splitable_field.each do |field, value|
|
117
|
-
new_event.set(field, value)
|
117
|
+
new_event.set(field, event.sprintf(value))
|
118
118
|
end
|
119
119
|
new_event.remove("@timestamp")
|
120
120
|
new_event.remove("@version")
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-input-faker'
|
4
|
-
s.version = '0.2.
|
4
|
+
s.version = '0.2.1'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "Generate log events with fake data"
|
7
7
|
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
|
data/spec/inputs/faker_spec.rb
CHANGED
@@ -19,7 +19,7 @@ describe LogStash::Inputs::Faker do
|
|
19
19
|
"test" => "field"
|
20
20
|
}
|
21
21
|
plg.add_splitable_faker_field = {
|
22
|
-
"[name][testing]" => "
|
22
|
+
"[name][testing]" => "Internet.user_name('%{first_name} %{last_name}', ['_'])"
|
23
23
|
}
|
24
24
|
plg.splitable_field_count = 10
|
25
25
|
|