26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/sentry_fs.rb', line 26
def self.parse(log_line)
log_line.chomp!
EXPRESSIONS.each {|name, regexp|
match = log_line.match(regexp)
if match
uuid = match.names.include?("uuid") ? match[:uuid] : nil
line = match.names.include?("line") ? match[:line] : nil
level = match.names.include?("level") ? match[:level].downcase : "err"
begin
json = JSON.parse(match[:message])
message = json["message"]
= json["extra"]
rescue JSON::ParserError
message = [line, match[:message]].compact.join(" ")
= {}
end
event = Event.new(
uuid: uuid,
message: message,
full_message: log_line,
extra: ,
level: level
)
return event
end
}
nil
end
|