Skip to content

Commit

Permalink
parser_syslog: Remove support_rfc5424_without_subseconds. Always true
Browse files Browse the repository at this point in the history
Signed-off-by: Masahiro Nakagawa <[email protected]>
  • Loading branch information
repeatedly committed Jun 3, 2020
1 parent 092c42d commit 5d60ada
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions lib/fluent/plugin/parser_syslog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 5d60ada

Please sign in to comment.