fluentd-ui 0.4.3 → 0.4.4

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: 20261f9c2c86bdd51ac0e63e061685b2bfba1e24
4
- data.tar.gz: a6fc1338a79f7fe027ba0741578f8c02ea831c96
3
+ metadata.gz: d8ed10127f4321d0c21f6c39e75b49957ac513a7
4
+ data.tar.gz: e78e3fd0a95570ff29e04ec013648ed4d13e1b78
5
5
  SHA512:
6
- metadata.gz: f83c80f732eed9ab0d4200dda63735047f76b0c35a7a6bea6e7dfa635496ec655b27157193850dfbef47c9b7c5a4cc6f2713efdf8eb806a0acb4064f4de812bc
7
- data.tar.gz: 5dc23b0d64c8c057490bb631f7df8e5ce2c77ff35b3fa9f30f0c7d624548ee24d7f043a5b687ce9f0fff4531fb8d0f37ecb78e67de2f990a6f5c538455aca95b
6
+ metadata.gz: 12b2478c0bb2f7da835daae83286cfcd5ff92b831067406921dca558bf9b0f6cd3dc5870c2c17ef41b06d66034aeecd5ee02cee7adac32394972c9b80860047b
7
+ data.tar.gz: ceca6e06deeb788d55c0c7fbd583dd7218d685e50a8d9389315dcf77a26adb951cb2268f229ea09249c9ec1a0d3cbd71861f8d8c0ddb591eccf35ced92b34f5c
@@ -1,3 +1,7 @@
1
+ ## Release 0.4.4 - 2017/04/25
2
+
3
+ * [fixed] Fix multiline parser preview bug [#209](https://github.com/fluent/fluentd-ui/pull/209)
4
+
1
5
  ## Release 0.4.3 - 2016/03/09
2
6
 
3
7
  * [fixed] Fix for latest fluentd [#200](https://github.com/fluent/fluentd-ui/pull/200)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fluentd-ui (0.4.3)
4
+ fluentd-ui (0.4.4)
5
5
  addressable
6
6
  bundler
7
7
  diff-lcs
@@ -25,69 +25,69 @@ PATH
25
25
  GEM
26
26
  remote: https://rubygems.org/
27
27
  specs:
28
- actionmailer (4.2.1)
29
- actionpack (= 4.2.1)
30
- actionview (= 4.2.1)
31
- activejob (= 4.2.1)
28
+ actionmailer (4.2.8)
29
+ actionpack (= 4.2.8)
30
+ actionview (= 4.2.8)
31
+ activejob (= 4.2.8)
32
32
  mail (~> 2.5, >= 2.5.4)
33
33
  rails-dom-testing (~> 1.0, >= 1.0.5)
34
- actionpack (4.2.1)
35
- actionview (= 4.2.1)
36
- activesupport (= 4.2.1)
34
+ actionpack (4.2.8)
35
+ actionview (= 4.2.8)
36
+ activesupport (= 4.2.8)
37
37
  rack (~> 1.6)
38
38
  rack-test (~> 0.6.2)
39
39
  rails-dom-testing (~> 1.0, >= 1.0.5)
40
- rails-html-sanitizer (~> 1.0, >= 1.0.1)
41
- actionview (4.2.1)
42
- activesupport (= 4.2.1)
40
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
41
+ actionview (4.2.8)
42
+ activesupport (= 4.2.8)
43
43
  builder (~> 3.1)
44
44
  erubis (~> 2.7.0)
45
45
  rails-dom-testing (~> 1.0, >= 1.0.5)
46
- rails-html-sanitizer (~> 1.0, >= 1.0.1)
47
- activejob (4.2.1)
48
- activesupport (= 4.2.1)
46
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
47
+ activejob (4.2.8)
48
+ activesupport (= 4.2.8)
49
49
  globalid (>= 0.3.0)
50
- activemodel (4.2.1)
51
- activesupport (= 4.2.1)
50
+ activemodel (4.2.8)
51
+ activesupport (= 4.2.8)
52
52
  builder (~> 3.1)
53
- activerecord (4.2.1)
54
- activemodel (= 4.2.1)
55
- activesupport (= 4.2.1)
53
+ activerecord (4.2.8)
54
+ activemodel (= 4.2.8)
55
+ activesupport (= 4.2.8)
56
56
  arel (~> 6.0)
57
- activesupport (4.2.1)
57
+ activesupport (4.2.8)
58
58
  i18n (~> 0.7)
59
- json (~> 1.7, >= 1.7.7)
60
59
  minitest (~> 5.1)
61
60
  thread_safe (~> 0.3, >= 0.3.4)
62
61
  tzinfo (~> 1.1)
63
- addressable (2.3.8)
64
- arel (6.0.0)
62
+ addressable (2.5.1)
63
+ public_suffix (~> 2.0, >= 2.0.2)
64
+ arel (6.0.4)
65
65
  better_errors (2.1.1)
66
66
  coderay (>= 1.0.0)
67
67
  erubis (>= 2.6.6)
68
68
  rack (>= 0.9.0)
69
69
  binding_of_caller (0.7.2)
70
70
  debug_inspector (>= 0.0.1)
71
- builder (3.2.2)
71
+ builder (3.2.3)
72
72
  capybara (2.4.4)
73
73
  mime-types (>= 1.16)
74
74
  nokogiri (>= 1.3.3)
75
75
  rack (>= 1.0.0)
76
76
  rack-test (>= 0.5.4)
77
77
  xpath (~> 2.0)
78
- capybara-screenshot (1.0.7)
78
+ capybara-screenshot (1.0.14)
79
79
  capybara (>= 1.0, < 3)
80
80
  launchy
81
81
  celluloid (0.15.2)
82
82
  timers (~> 1.1.0)
83
83
  cliver (0.3.2)
84
- coderay (1.1.0)
85
- cool.io (1.4.3)
86
- crack (0.4.2)
84
+ coderay (1.1.1)
85
+ cool.io (1.5.0)
86
+ crack (0.4.3)
87
87
  safe_yaml (~> 1.0.0)
88
88
  debug_inspector (0.0.2)
89
- diff-lcs (1.2.5)
90
- domain_name (0.5.23)
89
+ diff-lcs (1.3)
90
+ domain_name (0.5.20170404)
91
91
  unf (>= 0.0.5, < 1.0.0)
92
92
  draper (1.4.0)
93
93
  actionpack (>= 3.0)
@@ -95,26 +95,26 @@ GEM
95
95
  activesupport (>= 3.0)
96
96
  request_store (~> 1.0)
97
97
  erubis (2.7.0)
98
- factory_girl (4.5.0)
98
+ factory_girl (4.8.0)
99
99
  activesupport (>= 3.0.0)
100
- factory_girl_rails (4.5.0)
101
- factory_girl (~> 4.5.0)
100
+ factory_girl_rails (4.8.0)
101
+ factory_girl (~> 4.8.0)
102
102
  railties (>= 3.0.0)
103
- fluentd (0.12.7)
103
+ fluentd (0.12.35)
104
104
  cool.io (>= 1.2.2, < 2.0.0)
105
105
  http_parser.rb (>= 0.5.1, < 0.7.0)
106
106
  json (>= 1.4.3)
107
- msgpack (>= 0.5.11, < 0.6.0)
107
+ msgpack (>= 0.5.11, < 2)
108
108
  sigdump (~> 0.2.2)
109
- string-scrub (>= 0.0.3)
109
+ string-scrub (>= 0.0.3, <= 0.0.5)
110
110
  tzinfo (>= 1.0.0)
111
111
  tzinfo-data (>= 1.0.0)
112
112
  yajl-ruby (~> 1.0)
113
- font-awesome-rails (4.3.0.0)
114
- railties (>= 3.2, < 5.0)
115
- globalid (0.3.3)
116
- activesupport (>= 4.1.0)
117
- haml (4.0.6)
113
+ font-awesome-rails (4.7.0.1)
114
+ railties (>= 3.2, < 5.1)
115
+ globalid (0.4.0)
116
+ activesupport (>= 4.2.0)
117
+ haml (4.0.7)
118
118
  tilt
119
119
  haml-rails (0.5.3)
120
120
  actionpack (>= 4.0.1)
@@ -122,110 +122,111 @@ GEM
122
122
  haml (>= 3.1, < 5.0)
123
123
  railties (>= 4.0.1)
124
124
  hike (1.2.3)
125
- http-cookie (1.0.2)
125
+ http-cookie (1.0.3)
126
126
  domain_name (~> 0.5)
127
127
  http_parser.rb (0.6.0)
128
- httpclient (2.5.3.3)
129
- i18n (0.7.0)
128
+ httpclient (2.8.3)
129
+ i18n (0.8.1)
130
130
  i18n_generators (1.2.1)
131
131
  mechanize
132
132
  rails (>= 3.0.0)
133
- jbuilder (2.2.12)
134
- activesupport (>= 3.0.0, < 5)
133
+ jbuilder (2.6.3)
134
+ activesupport (>= 3.0.0, < 5.2)
135
135
  multi_json (~> 1.2)
136
- jquery-rails (3.1.2)
136
+ jquery-rails (3.1.4)
137
137
  railties (>= 3.0, < 5.0)
138
138
  thor (>= 0.14, < 2.0)
139
- json (1.8.2)
140
- kramdown (1.6.0)
139
+ json (2.1.0)
140
+ kramdown (1.13.2)
141
141
  kramdown-haml (0.0.3)
142
142
  haml
143
143
  launchy (2.4.3)
144
144
  addressable (~> 2.3)
145
- loofah (2.0.1)
145
+ loofah (2.0.3)
146
146
  nokogiri (>= 1.5.9)
147
- mail (2.6.3)
148
- mime-types (>= 1.16, < 3)
149
- mechanize (2.7.3)
147
+ mail (2.6.4)
148
+ mime-types (>= 1.16, < 4)
149
+ mechanize (2.7.5)
150
150
  domain_name (~> 0.5, >= 0.5.1)
151
151
  http-cookie (~> 1.0)
152
- mime-types (~> 2.0)
152
+ mime-types (>= 1.17.2)
153
153
  net-http-digest_auth (~> 1.1, >= 1.1.1)
154
154
  net-http-persistent (~> 2.5, >= 2.5.2)
155
- nokogiri (~> 1.4)
155
+ nokogiri (~> 1.6)
156
156
  ntlm-http (~> 0.1, >= 0.1.1)
157
157
  webrobots (>= 0.0.9, < 0.2)
158
158
  method_source (0.8.2)
159
- mime-types (2.4.3)
160
- mini_portile (0.6.2)
161
- minitest (5.5.1)
162
- msgpack (0.5.11)
163
- multi_json (1.11.0)
164
- net-http-digest_auth (1.4)
159
+ mime-types (3.1)
160
+ mime-types-data (~> 3.2015)
161
+ mime-types-data (3.2016.0521)
162
+ mini_portile2 (2.1.0)
163
+ minitest (5.10.1)
164
+ msgpack (1.1.0)
165
+ multi_json (1.12.1)
166
+ net-http-digest_auth (1.4.1)
165
167
  net-http-persistent (2.9.4)
166
- nokogiri (1.6.6.2)
167
- mini_portile (~> 0.6.0)
168
+ nokogiri (1.7.1)
169
+ mini_portile2 (~> 2.1.0)
168
170
  ntlm-http (0.1.1)
169
- poltergeist (1.6.0)
171
+ poltergeist (1.14.0)
170
172
  capybara (~> 2.1)
171
173
  cliver (~> 0.3.1)
172
- multi_json (~> 1.0)
173
174
  websocket-driver (>= 0.2.0)
174
- pry (0.10.1)
175
+ pry (0.10.4)
175
176
  coderay (~> 1.1.0)
176
177
  method_source (~> 0.8.1)
177
178
  slop (~> 3.4)
178
- pry-rails (0.3.4)
179
- pry (>= 0.9.10)
180
- puma (2.11.1)
181
- rack (>= 1.1, < 2.0)
182
- rack (1.6.0)
179
+ pry-rails (0.3.6)
180
+ pry (>= 0.10.4)
181
+ public_suffix (2.0.5)
182
+ puma (3.8.2)
183
+ rack (1.6.5)
183
184
  rack-test (0.6.3)
184
185
  rack (>= 1.0)
185
- rails (4.2.1)
186
- actionmailer (= 4.2.1)
187
- actionpack (= 4.2.1)
188
- actionview (= 4.2.1)
189
- activejob (= 4.2.1)
190
- activemodel (= 4.2.1)
191
- activerecord (= 4.2.1)
192
- activesupport (= 4.2.1)
186
+ rails (4.2.8)
187
+ actionmailer (= 4.2.8)
188
+ actionpack (= 4.2.8)
189
+ actionview (= 4.2.8)
190
+ activejob (= 4.2.8)
191
+ activemodel (= 4.2.8)
192
+ activerecord (= 4.2.8)
193
+ activesupport (= 4.2.8)
193
194
  bundler (>= 1.3.0, < 2.0)
194
- railties (= 4.2.1)
195
+ railties (= 4.2.8)
195
196
  sprockets-rails
196
197
  rails-deprecated_sanitizer (1.0.3)
197
198
  activesupport (>= 4.2.0.alpha)
198
- rails-dom-testing (1.0.6)
199
+ rails-dom-testing (1.0.8)
199
200
  activesupport (>= 4.2.0.beta, < 5.0)
200
- nokogiri (~> 1.6.0)
201
+ nokogiri (~> 1.6)
201
202
  rails-deprecated_sanitizer (>= 1.0.1)
202
- rails-html-sanitizer (1.0.2)
203
+ rails-html-sanitizer (1.0.3)
203
204
  loofah (~> 2.0)
204
- railties (4.2.1)
205
- actionpack (= 4.2.1)
206
- activesupport (= 4.2.1)
205
+ railties (4.2.8)
206
+ actionpack (= 4.2.8)
207
+ activesupport (= 4.2.8)
207
208
  rake (>= 0.8.7)
208
209
  thor (>= 0.18.1, < 2.0)
209
- rake (10.4.2)
210
- request_store (1.1.0)
211
- rspec-core (3.2.2)
212
- rspec-support (~> 3.2.0)
213
- rspec-expectations (3.2.0)
210
+ rake (12.0.0)
211
+ request_store (1.3.2)
212
+ rspec-core (3.5.4)
213
+ rspec-support (~> 3.5.0)
214
+ rspec-expectations (3.5.0)
214
215
  diff-lcs (>= 1.2.0, < 2.0)
215
- rspec-support (~> 3.2.0)
216
- rspec-mocks (3.2.1)
216
+ rspec-support (~> 3.5.0)
217
+ rspec-mocks (3.5.0)
217
218
  diff-lcs (>= 1.2.0, < 2.0)
218
- rspec-support (~> 3.2.0)
219
- rspec-rails (3.2.1)
220
- actionpack (>= 3.0, < 4.3)
221
- activesupport (>= 3.0, < 4.3)
222
- railties (>= 3.0, < 4.3)
223
- rspec-core (~> 3.2.0)
224
- rspec-expectations (~> 3.2.0)
225
- rspec-mocks (~> 3.2.0)
226
- rspec-support (~> 3.2.0)
227
- rspec-support (3.2.2)
228
- rubyzip (1.1.7)
219
+ rspec-support (~> 3.5.0)
220
+ rspec-rails (3.5.2)
221
+ actionpack (>= 3.0)
222
+ activesupport (>= 3.0)
223
+ railties (>= 3.0)
224
+ rspec-core (~> 3.5.0)
225
+ rspec-expectations (~> 3.5.0)
226
+ rspec-mocks (~> 3.5.0)
227
+ rspec-support (~> 3.5.0)
228
+ rspec-support (3.5.0)
229
+ rubyzip (1.2.1)
229
230
  safe_yaml (1.0.4)
230
231
  sass (3.2.19)
231
232
  sass-rails (4.0.5)
@@ -234,37 +235,37 @@ GEM
234
235
  sprockets (~> 2.8, < 3.0)
235
236
  sprockets-rails (~> 2.0)
236
237
  settingslogic (2.0.9)
237
- sigdump (0.2.2)
238
+ sigdump (0.2.4)
238
239
  simplecov (0.7.1)
239
240
  multi_json (~> 1.0)
240
241
  simplecov-html (~> 0.7.1)
241
242
  simplecov-html (0.7.1)
242
243
  slop (3.6.0)
243
- sprockets (2.12.3)
244
+ sprockets (2.12.4)
244
245
  hike (~> 1.2)
245
246
  multi_json (~> 1.0)
246
247
  rack (~> 1.0)
247
248
  tilt (~> 1.1, != 1.3.0)
248
- sprockets-rails (2.2.4)
249
+ sprockets-rails (2.3.3)
249
250
  actionpack (>= 3.0)
250
251
  activesupport (>= 3.0)
251
252
  sprockets (>= 2.8, < 4.0)
252
253
  string-scrub (0.0.5)
253
254
  sucker_punch (1.0.5)
254
255
  celluloid (~> 0.15.2)
255
- thor (0.19.1)
256
- thread_safe (0.3.5)
256
+ thor (0.19.4)
257
+ thread_safe (0.3.6)
257
258
  tilt (1.4.1)
258
- timecop (0.7.3)
259
+ timecop (0.8.1)
259
260
  timers (1.1.0)
260
- tzinfo (1.2.2)
261
+ tzinfo (1.2.3)
261
262
  thread_safe (~> 0.1)
262
- tzinfo-data (1.2015.2)
263
+ tzinfo-data (1.2017.2)
263
264
  tzinfo (>= 1.0.0)
264
265
  unf (0.1.4)
265
266
  unf_ext
266
- unf_ext (0.0.6)
267
- web-console (2.1.2)
267
+ unf_ext (0.0.7.4)
268
+ web-console (2.3.0)
268
269
  activemodel (>= 4.0)
269
270
  binding_of_caller (>= 0.7.2)
270
271
  railties (>= 4.0)
@@ -272,13 +273,13 @@ GEM
272
273
  webmock (1.18.0)
273
274
  addressable (>= 2.3.6)
274
275
  crack (>= 0.3.2)
275
- webrobots (0.1.1)
276
- websocket-driver (0.5.4)
276
+ webrobots (0.1.2)
277
+ websocket-driver (0.6.5)
277
278
  websocket-extensions (>= 0.1.0)
278
279
  websocket-extensions (0.1.2)
279
280
  xpath (2.0.0)
280
281
  nokogiri (~> 1.3)
281
- yajl-ruby (1.2.1)
282
+ yajl-ruby (1.3.0)
282
283
 
283
284
  PLATFORMS
284
285
  ruby
@@ -299,3 +300,6 @@ DEPENDENCIES
299
300
  timecop
300
301
  web-console (~> 2.0)
301
302
  webmock (~> 1.18.0)
303
+
304
+ BUNDLED WITH
305
+ 1.14.6
@@ -1,3 +1,3 @@
1
1
  module FluentdUI
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  end
@@ -27,24 +27,34 @@ module RegexpPreview
27
27
  reader = FileReverseReader.new(File.open(file))
28
28
  result = []
29
29
  target_lines = reader.tail(Settings.in_tail_preview_line_count).map{|line| line << "\n" }
30
- target_lines.each_with_index do |line, line_no|
31
- if line.match(params[:format_firstline])
32
- lines = target_lines[line_no, patterns.length]
33
- next if lines.length < patterns.length
34
- ret = detect_chunk(lines)
35
- next unless ret
36
- result << ret
37
- end
30
+ whole_string = target_lines.join
31
+ re_firstline = Regexp.new(params[:format_firstline])
32
+ indexes = []
33
+ cur = 0
34
+ while first_index = whole_string.index(re_firstline, cur)
35
+ indexes << first_index
36
+ cur = first_index + 1
37
+ end
38
+ indexes.each_with_index do |index, i|
39
+ next_index = indexes[i + 1] || -1
40
+ chunk = whole_string[index...next_index]
41
+ ret = detect_chunk(chunk)
42
+ next unless ret
43
+ result << ret
38
44
  end
39
45
  result
40
46
  end
41
47
 
42
- def detect_chunk(lines)
48
+ def detect_chunk(chunk)
43
49
  whole = ""
44
50
  matches = []
45
- lines.each_with_index do |line, i|
46
- match = line.match(patterns[i])
51
+ offset = 0
52
+ patterns.each do |pat|
53
+ match = chunk.match(pat)
47
54
  return nil unless match
55
+ offset = chunk.index(pat)
56
+ return nil if offset > 0
57
+ chunk = chunk[match[0].length..-1]
48
58
  match.names.each_with_index do |name, index|
49
59
  matches << {
50
60
  key: name,
@@ -52,7 +62,7 @@ module RegexpPreview
52
62
  pos: match.offset(index + 1).map{|pos| pos + whole.length},
53
63
  }
54
64
  end
55
- whole << line
65
+ whole << match[0]
56
66
  end
57
67
  {
58
68
  whole: whole,
@@ -63,7 +73,7 @@ module RegexpPreview
63
73
  def patterns
64
74
  @patterns ||= (1..20).map do |n|
65
75
  params["format#{n}"].presence
66
- end.compact.map {|pattern| Regexp.new(pattern)}
76
+ end.compact.map {|pattern| Regexp.new(pattern, Regexp::MULTILINE)}
67
77
  end
68
78
  end
69
79
  end
@@ -10,7 +10,7 @@ namespace :dep do
10
10
  "bundler" => "1.7.4" # bundler version does not appear in Gemfile.lock
11
11
  }
12
12
  skip_gems = %w(fluentd)
13
- ignore_gems_at_dump = %w(bundler rake json httpclient fluentd-ui) # these gems are installed by td-agent
13
+ ignore_gems_at_dump = %w(bundler rake json httpclient tzinfo tzinfo-data nokogiri thread_safe fluentd-ui) # these gems are installed by td-agent
14
14
  lock_file = "Gemfile.production.lock"
15
15
  unless ENV["SKIP_BUNDLE_INSTALL"]
16
16
  # ensure Gemfile.production.lock file is up to date
@@ -2,39 +2,115 @@ require 'spec_helper'
2
2
 
3
3
  describe RegexpPreview::MultiLine do
4
4
  describe "#matches_json" do
5
- subject { RegexpPreview::MultiLine.new(File.expand_path("./spec/support/fixtures/error0.log", Rails.root), "multiline", params).matches_json }
6
-
7
- let :params do
8
- params = {
9
- format_firstline: ".+",
10
- time_format: "time_format",
11
- }
12
- params["format1"] = "(?<foo>foo)"
13
- params["format2"] = "(?<bar>bar)"
14
- 3.upto(Fluentd::Setting::InTail::MULTI_LINE_MAX_FORMAT_COUNT) do |i|
15
- params["format#{i}"] = ""
5
+ subject { parser.matches_json }
6
+ let(:parser) { RegexpPreview::MultiLine.new(target_path, "multiline", params) }
7
+
8
+ describe "simple usage" do
9
+ let(:target_path) { File.expand_path("./spec/support/fixtures/error0.log", Rails.root) }
10
+
11
+ let :params do
12
+ params = {
13
+ format_firstline: "foo",
14
+ time_format: "time_format",
15
+ }
16
+ params["format1"] = "(?<foo>foo)\n"
17
+ params["format2"] = "(?<bar>bar)"
18
+ 3.upto(Fluentd::Setting::InTail::MULTI_LINE_MAX_FORMAT_COUNT) do |i|
19
+ params["format#{i}"] = ""
20
+ end
21
+ { params: params }
22
+ end
23
+
24
+ it 'should not have regexp and time_format in [:params][:setting]' do
25
+ expect(subject[:params][:setting]).to eq(regexp: nil, time_format: nil)
26
+ end
27
+
28
+ it "should include matches info" do
29
+ matches_info = {
30
+ whole: "foo\nbar",
31
+ matches: [
32
+ {
33
+ key: "foo", matched: "foo", pos: [0, 3]
34
+ },
35
+ {
36
+ key: "bar", matched: "bar", pos: [4, 7]
37
+ }
38
+ ]
39
+ }
40
+
41
+ expect(subject[:matches]).to include matches_info
16
42
  end
17
- { params: params }
18
43
  end
19
44
 
20
- it 'should not have regexp and time_format in [:params][:setting]' do
21
- expect(subject[:params][:setting]).to eq({ regexp: nil, time_format: nil })
45
+ describe "detect only continuos patterns" do
46
+ let(:target_path) { File.expand_path("./spec/support/fixtures/error0.log", Rails.root) }
47
+ let(:params) do
48
+ params = {
49
+ format_firstline: "foo",
50
+ time_format: "time_format",
51
+ }
52
+ params["format1"] = "(?<foo>foo)\n"
53
+ params["format2"] = "(?<bar>baz)"
54
+ 3.upto(Fluentd::Setting::InTail::MULTI_LINE_MAX_FORMAT_COUNT) do |i|
55
+ params["format#{i}"] = ""
56
+ end
57
+ { params: params }
58
+ end
59
+
60
+ it "shouldn't match" do
61
+ expect(subject[:matches]).to eq []
62
+ end
22
63
  end
23
64
 
24
- it "should include matches info" do
25
- matches_info = {
26
- whole: "foo\nbar\n",
27
- matches: [
28
- {
29
- key: "foo", matched: "foo", pos: [0, 3]
30
- },
31
- {
32
- key: "bar", matched: "bar", pos: [4, 7]
33
- }
34
- ]
35
- }
65
+ describe "example on document" do
66
+ # http://docs.fluentd.org/articles/in_tail
67
+ let(:target_path) { File.expand_path("./spec/support/fixtures/multiline_example.log", Rails.root) }
36
68
 
37
- expect(subject[:matches]).to include matches_info
69
+ let :params do
70
+ params = {
71
+ format_firstline: "\\d{4}-\\d{1,2}-\\d{1,2}",
72
+ "format1" => "^(?<time>\\d{4}-\\d{1,2}-\\d{1,2} \\d{1,2}:\\d{1,2}:\\d{1,2}) \\[(?<thread>.*)\\] (?<level>[^\\s]+)(?<message>.*)",
73
+ time_format: "time_format",
74
+ }
75
+ 2.upto(Fluentd::Setting::InTail::MULTI_LINE_MAX_FORMAT_COUNT) do |i|
76
+ params["format#{i}"] = ""
77
+ end
78
+ { params: params }
79
+ end
80
+
81
+ it "should include matches info" do
82
+ matches_info =
83
+ [
84
+ {
85
+ whole: "2013-3-03 14:27:33 [main] INFO Main - Start\n",
86
+ matches: [
87
+ {key: "time", matched: "2013-3-03 14:27:33", pos: [0, 18]},
88
+ {key: "thread", matched: "main", pos: [20, 24]},
89
+ {key: "level", matched: "INFO", pos: [26, 30]},
90
+ {key: "message", matched: " Main - Start\n", pos: [30, 45]}
91
+ ]
92
+ },
93
+ {
94
+ whole: "2013-3-03 14:27:33 [main] ERROR Main - Exception\njavax.management.RuntimeErrorException: null\n at Main.main(Main.java:16) ~[bin/:na]\n",
95
+ matches: [
96
+ {key: "time", matched: "2013-3-03 14:27:33", pos: [0, 18]},
97
+ {key: "thread", matched: "main", pos: [20, 24]},
98
+ {key: "level", matched: "ERROR", pos: [26, 31]},
99
+ {key: "message", matched: " Main - Exception\njavax.management.RuntimeErrorException: null\n at Main.main(Main.java:16) ~[bin/:na]\n", pos: [31, 136]},
100
+ ]
101
+ },
102
+ {
103
+ whole: "2013-3-03 14:27:33 [main] INFO Main - End",
104
+ matches: [
105
+ {key: "time", matched: "2013-3-03 14:27:33", pos: [0, 18]},
106
+ {key: "thread", matched: "main", pos: [20, 24]},
107
+ {key: "level", matched: "INFO", pos: [26, 30]},
108
+ {key: "message", matched: " Main - End", pos: [30, 42]},
109
+ ]
110
+ }
111
+ ]
112
+ expect(subject[:matches]).to eq matches_info
113
+ end
38
114
  end
39
115
  end
40
116
  end
@@ -0,0 +1,5 @@
1
+ 2013-3-03 14:27:33 [main] INFO Main - Start
2
+ 2013-3-03 14:27:33 [main] ERROR Main - Exception
3
+ javax.management.RuntimeErrorException: null
4
+ at Main.main(Main.java:16) ~[bin/:na]
5
+ 2013-3-03 14:27:33 [main] INFO Main - End
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluentd-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro Nakagawa
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-03-09 00:00:00.000000000 Z
12
+ date: 2017-04-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd
@@ -565,6 +565,7 @@ files:
565
565
  - spec/support/fixtures/error2.log
566
566
  - spec/support/fixtures/error3.log
567
567
  - spec/support/fixtures/error4.log
568
+ - spec/support/fixtures/multiline_example.log
568
569
  - spec/support/fluentd_agent_common_behavior.rb
569
570
  - spec/support/fluentd_agent_restart_strategy.rb
570
571
  - spec/support/javascript_macro.rb
@@ -708,7 +709,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
708
709
  version: '0'
709
710
  requirements: []
710
711
  rubyforge_project:
711
- rubygems_version: 2.2.2
712
+ rubygems_version: 2.6.11
712
713
  signing_key:
713
714
  specification_version: 4
714
715
  summary: Web UI for Fluentd
@@ -764,6 +765,7 @@ test_files:
764
765
  - spec/support/fixtures/error2.log
765
766
  - spec/support/fixtures/error3.log
766
767
  - spec/support/fixtures/error4.log
768
+ - spec/support/fixtures/multiline_example.log
767
769
  - spec/support/fluentd_agent_common_behavior.rb
768
770
  - spec/support/fluentd_agent_restart_strategy.rb
769
771
  - spec/support/javascript_macro.rb