Skip to content

Commit

Permalink
remove unless insertion and deletion
Browse files Browse the repository at this point in the history
Signed-off-by: Yuta Iwama <[email protected]>
  • Loading branch information
ganmacs committed Mar 18, 2020
1 parent f000aa2 commit ac3a09a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/fluent/plugin/parser_syslog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ def parse_rfc3164_regex(text, &block)

time_str = sq ? text.slice(idx, i - idx).squeeze(' ') : text.slice(idx, i - idx)
time = @mutex.synchronize { @time_parser.parse(time_str) }
record['time'] = time_str
if @keep_time_key
record['time'] = time_str
end

parse_plain(time, text, i + 1, record, RFC3164_CAPTURES, &block)
end
Expand Down Expand Up @@ -207,7 +209,9 @@ def parse_rfc5424_regex(text, &block)
end
end

record['time'] = time_str
if @keep_time_key
record['time'] = time_str
end
parse_plain(time, text, i + 1, record, RFC5424_CAPTURES, &block)
end

Expand All @@ -222,10 +226,6 @@ def parse_plain(time, text, idx, record, capture_list, &block)
return
end

unless @keep_time_key
record.delete('time'.freeze)
end

capture_list.each { |name|
if value = (m[name] rescue nil)
case name
Expand Down

0 comments on commit ac3a09a

Please sign in to comment.