File tree 3 files changed +24
-0
lines changed
3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,11 @@ def parseLocale(localeString)
126
126
public
127
127
def register
128
128
require "java"
129
+ if @match . length < 2
130
+ raise LogStash ::ConfigurationError , I18n . t ( "logstash.agent.configuration.invalid_plugin_register" ,
131
+ :plugin => "filter" , :type => "date" ,
132
+ :error => "The match setting should contains first a field name and at least one date format, current value is #{ @match } " )
133
+ end
129
134
# TODO(sissel): Need a way of capturing regexp configs better.
130
135
locale = parseLocale ( @config [ "locale" ] [ 0 ] ) if @config [ "locale" ] != nil and @config [ "locale" ] [ 0 ] != nil
131
136
setupMatcher ( @config [ "match" ] . shift , locale , @config [ "match" ] )
Original file line number Diff line number Diff line change 97
97
}
98
98
invalid_plugin_settings : >-
99
99
Something is wrong with your configuration.
100
+ invalid_plugin_register : >-
101
+ Cannot register %{plugin} %{type} plugin.
102
+ The error reported is:
103
+ %{error}
100
104
plugin_path_missing : >-
101
105
You specified a plugin path that does not exist: %{path}
102
106
no_plugins_found : |-
Original file line number Diff line number Diff line change 5
5
RUBY_ENGINE == "jruby" and describe LogStash ::Filters ::Date do
6
6
extend LogStash ::RSpec
7
7
8
+ describe "giving an invalid match config, raise a configuration error" do
9
+ config <<-CONFIG
10
+ filter {
11
+ date {
12
+ match => [ "mydate"]
13
+ }
14
+ }
15
+ CONFIG
16
+
17
+ sample "not_really_important" do
18
+ insist { subject } . raises LogStash ::ConfigurationError
19
+ end
20
+
21
+ end
22
+
8
23
describe "parsing with ISO8601" do
9
24
config <<-CONFIG
10
25
filter {
You can’t perform that action at this time.
0 commit comments