fluentd-ui 1.0.0.alpha.2 → 1.0.0.alpha.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fluentd-ui might be problematic. Click here for more details.

Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog.md +5 -0
  3. data/Gemfile.lock +56 -1
  4. data/README.md +2 -2
  5. data/app/controllers/api/config_definitions_controller.rb +55 -0
  6. data/app/controllers/api_controller.rb +20 -3
  7. data/app/controllers/concerns/setting_concern.rb +18 -2
  8. data/app/controllers/fluentd/settings/in_tail_controller.rb +13 -5
  9. data/app/controllers/fluentd/settings/out_forward_controller.rb +0 -9
  10. data/app/controllers/fluentd/settings/out_s3_controller.rb +0 -5
  11. data/app/controllers/fluentd/settings/out_tdlog_controller.rb +9 -0
  12. data/app/form_builders/fluentd_form_builder.rb +83 -0
  13. data/app/helpers/settings_helper.rb +81 -18
  14. data/app/javascript/packs/application.js +4 -0
  15. data/app/javascript/packs/in_tail_parse.js +159 -0
  16. data/app/javascript/packs/owned_plugin_form.js +141 -0
  17. data/app/javascript/packs/parser_multiline_form.js +51 -0
  18. data/app/javascript/packs/plugin_setting.js +19 -0
  19. data/app/models/concerns/fluentd/setting/configurable.rb +113 -0
  20. data/app/models/concerns/fluentd/setting/pattern.rb +11 -0
  21. data/app/models/concerns/fluentd/setting/plugin.rb +78 -0
  22. data/app/models/concerns/fluentd/setting/plugin_config.rb +74 -0
  23. data/app/models/concerns/fluentd/setting/plugin_parameter.rb +121 -0
  24. data/app/models/concerns/fluentd/setting/section_parser.rb +36 -0
  25. data/app/models/concerns/fluentd/setting/section_validator.rb +21 -0
  26. data/app/models/fluentd.rb +5 -5
  27. data/app/models/fluentd/setting/buffer_file.rb +23 -0
  28. data/app/models/fluentd/setting/buffer_memory.rb +17 -0
  29. data/app/models/fluentd/setting/formatter_csv.rb +21 -0
  30. data/app/models/fluentd/setting/formatter_hash.rb +19 -0
  31. data/app/models/fluentd/setting/formatter_json.rb +25 -0
  32. data/app/models/fluentd/setting/formatter_ltsv.rb +21 -0
  33. data/app/models/fluentd/setting/formatter_msgpack.rb +13 -0
  34. data/app/models/fluentd/setting/formatter_out_file.rb +21 -0
  35. data/app/models/fluentd/setting/formatter_single_value.rb +20 -0
  36. data/app/models/fluentd/setting/formatter_stdout.rb +19 -0
  37. data/app/models/fluentd/setting/formatter_tsv.rb +21 -0
  38. data/app/models/fluentd/setting/in_forward.rb +7 -17
  39. data/app/models/fluentd/setting/in_http.rb +13 -19
  40. data/app/models/fluentd/setting/in_monitor_agent.rb +6 -19
  41. data/app/models/fluentd/setting/in_syslog.rb +14 -12
  42. data/app/models/fluentd/setting/in_tail.rb +7 -84
  43. data/app/models/fluentd/setting/out_elasticsearch.rb +12 -21
  44. data/app/models/fluentd/setting/out_forward.rb +22 -66
  45. data/app/models/fluentd/setting/out_mongo.rb +20 -26
  46. data/app/models/fluentd/setting/out_s3.rb +18 -30
  47. data/app/models/fluentd/setting/out_stdout.rb +21 -18
  48. data/app/models/fluentd/setting/out_tdlog.rb +35 -0
  49. data/app/models/fluentd/setting/parser_apache.rb +13 -0
  50. data/app/models/fluentd/setting/parser_apache2.rb +13 -0
  51. data/app/models/fluentd/setting/parser_apache_error.rb +13 -0
  52. data/app/models/fluentd/setting/parser_csv.rb +22 -0
  53. data/app/models/fluentd/setting/parser_in_http.rb +13 -0
  54. data/app/models/fluentd/setting/parser_json.rb +25 -0
  55. data/app/models/fluentd/setting/parser_ltsv.rb +30 -0
  56. data/app/models/fluentd/setting/parser_msgpack.rb +13 -0
  57. data/app/models/fluentd/setting/parser_multiline.rb +24 -0
  58. data/app/models/fluentd/setting/parser_nginx.rb +13 -0
  59. data/app/models/fluentd/setting/parser_none.rb +19 -0
  60. data/app/models/fluentd/setting/parser_regexp.rb +26 -0
  61. data/app/models/fluentd/setting/parser_syslog.rb +29 -0
  62. data/app/models/fluentd/setting/parser_tsv.rb +19 -0
  63. data/app/models/fluentd/setting/section.rb +38 -0
  64. data/app/models/fluentd/setting/storage_local.rb +22 -0
  65. data/app/models/fluentd/setting/type/array.rb +17 -0
  66. data/app/models/fluentd/setting/type/bool.rb +18 -0
  67. data/app/models/fluentd/setting/type/enum.rb +17 -0
  68. data/app/models/fluentd/setting/type/hash.rb +17 -0
  69. data/app/models/fluentd/setting/type/regexp.rb +17 -0
  70. data/app/models/fluentd/setting/type/section.rb +17 -0
  71. data/app/models/fluentd/setting/type/size.rb +17 -0
  72. data/app/models/fluentd/setting/type/time.rb +17 -0
  73. data/app/views/api/settings/_element.json.jbuilder +1 -1
  74. data/app/views/fluentd/settings/in_forward/_form.html.haml +16 -0
  75. data/app/views/fluentd/settings/in_tail/_form.html.haml +22 -29
  76. data/app/views/fluentd/settings/in_tail/after_file_choose.html.haml +1 -1
  77. data/app/views/fluentd/settings/in_tail/after_format.html.haml +4 -4
  78. data/app/views/fluentd/settings/in_tail/confirm.html.haml +5 -5
  79. data/app/views/fluentd/settings/source_and_output.html.haml +1 -1
  80. data/app/views/shared/_global_nav.html.erb +8 -8
  81. data/app/views/shared/settings/_form.html.haml +40 -9
  82. data/app/views/shared/settings/show.html.haml +4 -1
  83. data/app/views/shared/vue/_in_tail_parse.html.haml +20 -0
  84. data/app/views/shared/vue/_owned_plugin_form.html.haml +68 -0
  85. data/app/views/shared/vue/_parser_multiline_form.html.haml +19 -0
  86. data/app/views/shared/vue/_setting.html.erb +1 -1
  87. data/config/application.rb +1 -1
  88. data/config/environment.rb +3 -0
  89. data/config/initializers/types.rb +7 -0
  90. data/config/routes.rb +2 -1
  91. data/fluentd-ui.gemspec +5 -0
  92. data/lib/fluentd-ui/version.rb +1 -1
  93. data/lib/regexp_preview.rb +2 -2
  94. data/lib/regexp_preview/multi_line.rb +53 -63
  95. data/lib/regexp_preview/single_line.rb +40 -46
  96. data/spec/features/fluentd/setting/out_forward_spec.rb +1 -1
  97. data/spec/features/fluentd/setting/out_stdout_spec.rb +1 -1
  98. data/spec/features/{out_td_spec.rb → out_tdlog_spec.rb} +3 -3
  99. data/spec/lib/regexp_preview/multi_line_spec.rb +29 -34
  100. data/spec/lib/regexp_preview/single_line_spec.rb +89 -87
  101. data/spec/models/fluentd/setting/in_forward_spec.rb +75 -0
  102. data/spec/models/fluentd/setting/in_http_spec.rb +31 -0
  103. data/spec/models/fluentd/setting/in_monitor_agent_spec.rb +31 -0
  104. data/spec/models/fluentd/setting/in_syslog_spec.rb +65 -7
  105. data/spec/models/fluentd/setting/in_tail_spec.rb +47 -0
  106. data/spec/models/fluentd/setting/out_elasticsearch_spec.rb +31 -0
  107. data/spec/models/fluentd/setting/out_mongo_spec.rb +35 -12
  108. data/spec/models/fluentd/setting/out_s3_spec.rb +128 -0
  109. data/spec/models/fluentd/setting/out_stdout_spec.rb +31 -0
  110. data/spec/models/fluentd/setting/out_tdlog_spec.rb +47 -0
  111. metadata +164 -38
  112. data/app/controllers/fluentd/settings/out_td_controller.rb +0 -18
  113. data/app/helpers/fluentd/settings_helper.rb +0 -2
  114. data/app/javascript/packs/in_tail_format.js +0 -174
  115. data/app/models/fluentd/setting/common.rb +0 -185
  116. data/app/models/fluentd/setting/out_td.rb +0 -48
  117. data/app/views/shared/vue/_in_tail_format.html.erb +0 -43
  118. data/spec/models/fluentd/setting/common_spec.rb +0 -178
  119. data/spec/models/fluentd/setting/out_td_spec.rb +0 -38
@@ -2,123 +2,109 @@ require 'spec_helper'
2
2
 
3
3
  describe RegexpPreview::SingleLine do
4
4
  describe ".initialize" do
5
- subject { RegexpPreview::SingleLine.new("log_file.log", format, params) }
6
-
7
- describe "format" do
8
- let :params do
9
- {
10
- regexp: "(?<category>\[.+\])",
11
- time_format: "%y/%m/%d",
12
- }
13
- end
5
+ subject { RegexpPreview::SingleLine.new("log_file.log", plugin_name, plugin_config) }
14
6
 
15
- shared_examples "should set regexp and time_format from selected format" do
16
- it do
17
- expect(subject.regexp).to eq regexp
18
- expect(subject.time_format).to eq time_format
19
- expect(subject.params).to eq params
20
- end
7
+ describe "parse" do
8
+ let :plugin_config do
9
+ {}
21
10
  end
22
11
 
23
- shared_examples "should set params only" do
24
- include_examples "should set regexp and time_format from selected format" do
25
- let(:regexp) { nil }
26
- let(:time_format) { nil }
12
+ shared_examples "should create parser plugin instance from selected plugin name" do
13
+ it do
14
+ expect(subject.plugin).to(be_an_instance_of(plugin_class))
27
15
  end
28
16
  end
29
17
 
30
18
  context "regexp" do
31
- let(:format) { "regexp" }
32
-
33
- it 'should set regexp from params' do
34
- expect(subject.regexp).to eq /#{params[:regexp]}/
35
- expect(subject.time_format).to be_nil
36
- expect(subject.params).to eq params
19
+ let(:plugin_name) { "regexp" }
20
+ let(:plugin_class) { Fluent::Plugin::RegexpParser }
21
+ let :plugin_config do
22
+ {
23
+ "expression" => "(?<category>\[.+\])",
24
+ "time_format" => "%y/%m/%d",
25
+ }
37
26
  end
27
+ include_examples("should create parser plugin instance from selected plugin name")
38
28
  end
39
29
 
40
30
  context "ltsv" do
41
- let(:format) { "ltsv" }
31
+ let(:plugin_name) { "ltsv" }
32
+ let(:plugin_class) { Fluent::Plugin::LabeledTSVParser }
42
33
 
43
- include_examples "should set params only"
34
+ include_examples("should create parser plugin instance from selected plugin name")
44
35
  end
45
36
 
46
37
  context "json" do
47
- let(:format) { "json" }
38
+ let(:plugin_name) { "json" }
39
+ let(:plugin_class) { Fluent::Plugin::JSONParser }
48
40
 
49
- include_examples "should set params only"
41
+ include_examples("should create parser plugin instance from selected plugin name")
50
42
  end
51
43
 
52
44
  context "csv" do
53
- let(:format) { "csv" }
45
+ let(:plugin_name) { "csv" }
46
+ let(:plugin_class) { Fluent::Plugin::CSVParser }
47
+ let(:plugin_config) do
48
+ {
49
+ "keys" => "column1,column2"
50
+ }
51
+ end
54
52
 
55
- include_examples "should set params only"
53
+ include_examples("should create parser plugin instance from selected plugin name")
56
54
  end
57
55
 
58
56
  context "tsv" do
59
- let(:format) { "tsv" }
57
+ let(:plugin_name) { "tsv" }
58
+ let(:plugin_class) { Fluent::Plugin::TSVParser }
59
+ let(:plugin_config) do
60
+ {
61
+ "keys" => "column1,column2"
62
+ }
63
+ end
60
64
 
61
- include_examples "should set params only"
65
+ include_examples("should create parser plugin instance from selected plugin name")
62
66
  end
63
67
 
64
68
  context "syslog" do # "apache", "nginx", etc
65
- let(:format) { "syslog" }
69
+ let(:plugin_name) { "syslog" }
70
+ let(:plugin_class) { Fluent::Plugin::SyslogParser }
66
71
 
67
- include_examples "should set regexp and time_format from selected format" do
68
- let(:regexp) do
69
- /^(?<time>[^ ]*\s*[^ ]* [^ ]*) (?<host>[^ ]*) (?<ident>[^ :\[]*)(?:\[(?<pid>[0-9]+)\])?(?:[^\:]*\:)? *(?<message>.*)$/
70
- end
71
- let(:time_format) { "%b %d %H:%M:%S" }
72
- end
72
+ include_examples("should create parser plugin instance from selected plugin name")
73
73
  end
74
74
 
75
75
  context "apache" do
76
- let(:format) { "apache" }
76
+ let(:plugin_name) { "apache" }
77
+ let(:plugin_class) { Fluent::Plugin::ApacheParser }
77
78
 
78
- include_examples "should set regexp and time_format from selected format" do
79
- let(:regexp) do
80
- /^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^ ]*) +\S*)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?$/
81
- end
82
- let(:time_format) { "%d/%b/%Y:%H:%M:%S %z" }
83
- end
79
+ include_examples("should create parser plugin instance from selected plugin name")
84
80
  end
85
81
 
86
82
  context "nginx" do
87
- let(:format) { "nginx" }
83
+ let(:plugin_name) { "nginx" }
84
+ let(:plugin_class) { Fluent::Plugin::NginxParser }
88
85
 
89
- include_examples "should set regexp and time_format from selected format" do
90
- let(:regexp) do
91
- /^(?<remote>[^ ]*) (?<host>[^ ]*) (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)"(?:\s+(?<http_x_forwarded_for>[^ ]+))?)?$/
92
- end
93
- let(:time_format) { "%d/%b/%Y:%H:%M:%S %z" }
94
- end
86
+ include_examples("should create parser plugin instance from selected plugin name")
95
87
  end
96
88
  end
97
89
  end
98
90
 
99
- describe "#matches_json" do
91
+ describe "#matches" do
100
92
  let(:logfile) { File.expand_path(logfile_path, Rails.root) }
101
- let :params do
102
- {
103
- regexp: "(?<regexp>bar)", # bar from error0.log
104
- time_format: "time_format",
105
- }
106
- end
107
-
108
- subject { RegexpPreview::SingleLine.new(logfile, format, params).matches_json }
93
+ subject { RegexpPreview::SingleLine.new(logfile, plugin_name, plugin_config).matches }
109
94
 
110
- describe "format" do
95
+ describe "parse" do
111
96
  context "regexp" do
112
- let(:format) { "regexp" }
97
+ let(:plugin_name) { "regexp" }
113
98
  let(:logfile_path) { "./spec/support/fixtures/error0.log" }
114
-
115
- it 'should have regexp only in [:params][:setting]' do
116
- setting_json = {
117
- regexp: params[:regexp],
118
- time_format: nil
99
+ let :plugin_config do
100
+ {
101
+ "expression" => "(?<regexp>bar)", # bar from error0.log
102
+ "time_format" => "time_format",
119
103
  }
104
+ end
120
105
 
121
- expect(subject[:params][:setting]).to eq setting_json
106
+ it 'should have regexp only in [:params][:setting]' do
107
+ expect(subject[:pluginConfig]).to eq plugin_config
122
108
  end
123
109
 
124
110
  it 'should include matches info' do
@@ -133,16 +119,12 @@ describe RegexpPreview::SingleLine do
133
119
  end
134
120
 
135
121
  context "csv" do
136
- let(:format) { "csv" }
122
+ let(:plugin_name) { "csv" }
137
123
  let(:logfile_path) { "./spec/support/fixtures/error0.log" }
138
-
139
- it 'should not have regexp and time_format in [:params][:setting]' do
140
- setting_json = {
141
- regexp: nil,
142
- time_format: nil
124
+ let :plugin_config do
125
+ {
126
+ "keys" => "column1,column2"
143
127
  }
144
-
145
- expect(subject[:params][:setting]).to eq setting_json
146
128
  end
147
129
 
148
130
  it 'should not have matches_info' do
@@ -151,26 +133,46 @@ describe RegexpPreview::SingleLine do
151
133
  end
152
134
 
153
135
  context "syslog" do
154
- let(:format) { "syslog" }
155
136
  let(:logfile_path) { "./spec/support/fixtures/error4.log" }
137
+ let(:plugin_name) { "syslog" }
138
+ let(:plugin_config) do
139
+ {
140
+ "time_format" => "%Y-%m-%d %H:%M:%S %z",
141
+ "keep_time_key" => true
142
+ }
143
+ end
156
144
 
157
- it 'should set regexp and time_format from syslog format' do
158
- setting_json = {
159
- regexp: "^(?<time>[^ ]*\\s*[^ ]* [^ ]*) (?<host>[^ ]*) (?<ident>[^ :\\[]*)(?:\\[(?<pid>[0-9]+)\\])?(?:[^\\:]*\\:)? *(?<message>.*)$",
160
- time_format: "%b %d %H:%M:%S",
145
+ it 'should include matches info' do
146
+ matches_info = {
147
+ whole: "2014-05-27 10:54:37 +0900 [info]: listening fluent socket on 0.0.0.0:24224",
148
+ matches: [
149
+ { key: "time", matched: "2014-05-27 10:54:37 +0900", pos: [0, 25] },
150
+ { key: "host", matched: "[info]:", pos: [26, 33] },
151
+ { key: "ident", matched: "listening", pos: [34, 43] },
152
+ { key: "message", matched: "24224", pos: [69, 74] }
153
+ ]
161
154
  }
162
155
 
163
- expect(subject[:params][:setting]).to eq setting_json
156
+ expect(subject[:matches]).to include matches_info
157
+ end
158
+ end
159
+
160
+ context "syslog when keep_time_key is false" do
161
+ let(:logfile_path) { "./spec/support/fixtures/error4.log" }
162
+ let(:plugin_name) { "syslog" }
163
+ let(:plugin_config) do
164
+ {
165
+ "time_format" => "%Y-%m-%d %H:%M:%S %z",
166
+ "keep_time_key" => false
167
+ }
164
168
  end
165
169
 
166
170
  it 'should include matches info' do
167
171
  matches_info = {
168
172
  whole: "2014-05-27 10:54:37 +0900 [info]: listening fluent socket on 0.0.0.0:24224",
169
173
  matches: [
170
- { key: "time", matched: "2014-05-27 10:54:37 +0900", pos: [0, 25] },
171
174
  { key: "host", matched: "[info]:", pos: [26, 33] },
172
175
  { key: "ident", matched: "listening", pos: [34, 43] },
173
- { key: "pid", matched: nil, pos: [nil, nil] },
174
176
  { key: "message", matched: "24224", pos: [69, 74] }
175
177
  ]
176
178
  }
@@ -0,0 +1,75 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fluentd::Setting::InForward do
4
+ let(:klass) { described_class }
5
+ let(:instance) { klass.new(valid_attributes) }
6
+ let(:valid_attributes) {
7
+ {}
8
+ }
9
+
10
+ describe "#valid?" do
11
+ it "should be valid" do
12
+ params = valid_attributes.dup
13
+ klass.new(params).should be_valid
14
+ end
15
+ end
16
+
17
+ describe "#plugin_name" do
18
+ subject { instance.plugin_name }
19
+ it { should == "forward" }
20
+ end
21
+
22
+ describe "#plugin_type" do
23
+ subject { instance.plugin_type }
24
+ it { should == "input" }
25
+ end
26
+
27
+ describe "#to_config" do
28
+ subject { instance.to_config.to_s }
29
+ it { should include("@type forward") }
30
+ end
31
+
32
+ describe "with security section" do
33
+ let(:valid_attributes) {
34
+ {
35
+ security: {
36
+ "0" => {
37
+ self_hostname: "test.fluentd",
38
+ shared_key: "secretsharedkey",
39
+ }
40
+ }
41
+ }
42
+ }
43
+ let(:expected) {
44
+ <<-CONFIG
45
+ <source>
46
+ @type forward
47
+ <security>
48
+ self_hostname test.fluentd
49
+ shared_key secretsharedkey
50
+ </security>
51
+ </source>
52
+ CONFIG
53
+ }
54
+ subject { instance.to_config.to_s }
55
+ it { should == expected }
56
+ end
57
+
58
+ describe "with invalid security section" do
59
+ let(:valid_attributes) {
60
+ {
61
+ security: {
62
+ "0" => {
63
+ self_hostname: "test.fluentd",
64
+ }
65
+ }
66
+ }
67
+ }
68
+ it { instance.should_not be_valid }
69
+ it {
70
+ instance.validate
71
+ instance.errors.full_messages.should include("Security Shared key can't be blank")
72
+ }
73
+ end
74
+ end
75
+
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fluentd::Setting::InHttp do
4
+ let(:klass) { described_class }
5
+ let(:instance) { klass.new(valid_attributes) }
6
+ let(:valid_attributes) {
7
+ {}
8
+ }
9
+
10
+ describe "#valid?" do
11
+ it "should be valid" do
12
+ params = valid_attributes.dup
13
+ klass.new(params).should be_valid
14
+ end
15
+ end
16
+
17
+ describe "#plugin_name" do
18
+ subject { instance.plugin_name }
19
+ it { should == "http" }
20
+ end
21
+
22
+ describe "#plugin_type" do
23
+ subject { instance.plugin_type }
24
+ it { should == "input" }
25
+ end
26
+
27
+ describe "#to_config" do
28
+ subject { instance.to_config.to_s }
29
+ it { should include("@type http") }
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fluentd::Setting::InMonitorAgent do
4
+ let(:klass) { described_class }
5
+ let(:instance) { klass.new(valid_attributes) }
6
+ let(:valid_attributes) {
7
+ {}
8
+ }
9
+
10
+ describe "#valid?" do
11
+ it "should be valid" do
12
+ params = valid_attributes.dup
13
+ klass.new(params).should be_valid
14
+ end
15
+ end
16
+
17
+ describe "#plugin_name" do
18
+ subject { instance.plugin_name }
19
+ it { should == "monitor_agent" }
20
+ end
21
+
22
+ describe "#plugin_type" do
23
+ subject { instance.plugin_type }
24
+ it { should == "input" }
25
+ end
26
+
27
+ describe "#to_config" do
28
+ subject { instance.to_config.to_s }
29
+ it { should include("@type monitor_agent") }
30
+ end
31
+ end
@@ -17,19 +17,77 @@ describe Fluentd::Setting::InSyslog do
17
17
  end
18
18
  end
19
19
 
20
- describe "#plugin_type_name" do
21
- subject { instance.plugin_type_name }
20
+ describe "#plugin_name" do
21
+ subject { instance.plugin_name }
22
22
  it { should == "syslog" }
23
23
  end
24
24
 
25
- describe "#input_plugin" do
26
- it { instance.should be_input_plugin }
27
- it { instance.should_not be_output_plugin }
25
+ describe "#plugin_type" do
26
+ subject { instance.plugin_type }
27
+ it { should == "input" }
28
28
  end
29
29
 
30
30
  describe "#to_config" do
31
- subject { instance.to_config }
32
- it { should include("type syslog") }
31
+ subject { instance.to_config.to_s }
32
+ it { should include("@type syslog") }
33
+ end
34
+
35
+ describe "with parse section" do
36
+ let(:valid_attributes) {
37
+ {
38
+ tag: "test",
39
+ parse: {
40
+ "0" => {
41
+ "@type" => "syslog",
42
+ "message_format" => "rfc5424"
43
+ }
44
+ }
45
+ }
46
+ }
47
+ let(:expected) {
48
+ <<-CONFIG
49
+ <source>
50
+ @type syslog
51
+ tag test
52
+ <parse>
53
+ @type syslog
54
+ message_format rfc5424
55
+ </parse>
56
+ </source>
57
+ CONFIG
58
+ }
59
+ subject { instance.to_config.to_s }
60
+ it { should == expected }
61
+ end
62
+
63
+ describe "with @log_level" do
64
+ let(:valid_attributes) {
65
+ {
66
+ tag: "test",
67
+ log_level: "debug",
68
+ parse: {
69
+ "0" => {
70
+ "@type" => "syslog",
71
+ "message_format" => "rfc5424"
72
+ }
73
+ }
74
+ }
75
+ }
76
+ let(:expected) {
77
+ <<-CONFIG
78
+ <source>
79
+ @type syslog
80
+ tag test
81
+ @log_level debug
82
+ <parse>
83
+ @type syslog
84
+ message_format rfc5424
85
+ </parse>
86
+ </source>
87
+ CONFIG
88
+ }
89
+ subject { instance.to_config.to_s }
90
+ it { should == expected }
33
91
  end
34
92
  end
35
93