mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
because english is kinda expressive enough language
This commit is contained in:
parent
aa4c29a866
commit
d246d28bbd
2 changed files with 4 additions and 4 deletions
|
@ -26,14 +26,14 @@ class LogStash::Filters::CSV < LogStash::Filters::Base
|
|||
# Define the column separator value. If this is not specified the default
|
||||
# is a comma ','
|
||||
# Optional.
|
||||
config :col_sep, :validate => :string, :default => ","
|
||||
config :separator, :validate => :string, :default => ","
|
||||
|
||||
public
|
||||
def register
|
||||
@csv = {}
|
||||
|
||||
@config.each do |field, dest|
|
||||
next if (RESERVED + ["fields", "col_sep"]).member?(field)
|
||||
next if (RESERVED + ["fields", "separator"]).member?(field)
|
||||
@csv[field] = dest
|
||||
end
|
||||
|
||||
|
@ -65,7 +65,7 @@ class LogStash::Filters::CSV < LogStash::Filters::Base
|
|||
|
||||
raw = event[key].first
|
||||
begin
|
||||
values = CSV.parse_line(raw, {:col_sep => @col_sep})
|
||||
values = CSV.parse_line(raw, {:col_sep => @separator})
|
||||
data = {}
|
||||
values.each_index do |i|
|
||||
field_name = @fields[i] || "field#{i+1}"
|
||||
|
|
|
@ -42,7 +42,7 @@ describe LogStash::Filters::CSV do
|
|||
config <<-CONFIG
|
||||
filter {
|
||||
csv {
|
||||
col_sep => ";"
|
||||
separator => ";"
|
||||
}
|
||||
}
|
||||
CONFIG
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue