Skip to content

Commit

Permalink
- Add tag 'multiline' if an event is successfully parsed as a multiline
Browse files Browse the repository at this point in the history
message.
  • Loading branch information
jordansissel committed Nov 20, 2010
1 parent eba5264 commit 03ba706
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/logstash/filters/multiline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,22 @@ def register
@logger.fatal(["Invalid pattern for multiline filter on type '#{type}'",
typeconfig, e])
end

end # @config.each
end # def register

def filter(event)
return unless @types.member?(event.type)
typeconfig = @types[event.type]
#@types[event.type].each do |key, value|
#puts "#{event.type}: " + typeconfig.inspect
match = typeconfig["pattern"].match(event.message)
key = [event.source, event.type]
pending = @pending[key]

@logger.info(["Reg: ", typeconfig["pattern"], event.message, match])
case typeconfig["what"]
when "previous"
if match
event.tags |= ["multiline"]
# previous previous line is part of this event.
# append it to the event and cancel it
if pending
Expand All @@ -120,6 +121,7 @@ def filter(event)
end # if/else match
when "next"
if match
event.tags |= ["multiline"]
# this line is part of a multiline event, the next
# line will be part, too, put it into pending.
if pending
Expand Down

0 comments on commit 03ba706

Please sign in to comment.