From 5d60ada3e59fb65a6fbcb7a1906f87b6f2f02040 Mon Sep 17 00:00:00 2001 From: Masahiro Nakagawa Date: Wed, 3 Jun 2020 11:26:35 +0900 Subject: [PATCH] parser_syslog: Remove support_rfc5424_without_subseconds. Always true Signed-off-by: Masahiro Nakagawa --- lib/fluent/plugin/parser_syslog.rb | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/lib/fluent/plugin/parser_syslog.rb b/lib/fluent/plugin/parser_syslog.rb index 452830a31b..d11662f714 100644 --- a/lib/fluent/plugin/parser_syslog.rb +++ b/lib/fluent/plugin/parser_syslog.rb @@ -73,7 +73,6 @@ def initialize @space_count_rfc5424 = nil @skip_space_count_rfc3164 = false @skip_space_count_rfc5424 = false - @support_rfc5424_without_subseconds = false @time_parser_rfc5424_without_subseconds = nil end @@ -135,7 +134,6 @@ def setup_time_parser_5424(time_fmt) @time_parser_rfc5424_without_subseconds = time_parser_create(format: "%Y-%m-%dT%H:%M:%S%z") @skip_space_count_rfc5424 = time_fmt.count(' ').zero? @space_count_rfc5424 = time_fmt.squeeze(' ').count(' ') + 1 - @support_rfc5424_without_subseconds = true end # this method is for tests @@ -149,7 +147,6 @@ def parse(text) def parse_auto(text, &block) if REGEXP_DETECT_RFC5424.match?(text) - @support_rfc5424_without_subseconds = true if @regexp_parser parse_rfc5424_regex(text, &block) else @@ -231,12 +228,8 @@ def parse_rfc5424_regex(text, &block) begin @time_parser_rfc5424.parse(time_str) rescue Fluent::TimeParser::TimeParseError => e - if @support_rfc5424_without_subseconds - log.trace(e) - @time_parser_rfc5424_without_subseconds.parse(time_str) - else - raise - end + log.trace(e) + @time_parser_rfc5424_without_subseconds.parse(time_str) end end @@ -492,11 +485,7 @@ def parse_rfc5424(text, &block) time = begin @time_parser_rfc5424.parse(time_str) rescue Fluent::TimeParser::TimeParseError => e - if @support_rfc5424_without_subseconds - @time_parser_rfc5424_without_subseconds.parse(time_str) - else - raise - end + @time_parser_rfc5424_without_subseconds.parse(time_str) end record['time'] = time_str if @keep_time_key