Skip to content

Commit

Permalink
Avoid to create MatachData object
Browse files Browse the repository at this point in the history
Signed-off-by: Yuta Iwama <ganmacs@gmail.com>
  • Loading branch information
ganmacs committed Mar 16, 2020
1 parent ca1c971 commit e400900
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/fluent/plugin/parser_syslog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,10 @@ def parse_rfc3164_regex(text, &block)
record = {}

if @with_priority
if (m = RFC3164_PRI_REGEXP.match(text))
record['pri'] = Integer(m['pri'])
idx = m.end(0)
if RFC3164_PRI_REGEXP.match?(text)
v = text.index('>')
record['pri'] = text[1..v].to_i # trim `<` and ``>
idx = v + 1
else
yield(nil, nil)
return
Expand Down

0 comments on commit e400900

Please sign in to comment.