我有这种格式的日志:
2015-02-25 18:33:06,975 INFO c.a.p.c.b.s.Monitor akka://application/user/daemons/monitor : 91 active threads, 4175691776 bytes used
Run Code Online (Sandbox Code Playgroud)
我想到了这个正则表达式:
(?<time>[^ ]* [^ ]*) (?<method>[^ ]*) (?<path>[^ ]*) (?<message>[^ ].*$)
Run Code Online (Sandbox Code Playgroud)
当我在Fluentular 中测试时 (我将使用它作为 fluentd 日志输入的格式)我得到以下字段:
time => 2015/02/25 18:33:06 +0000
method => INFO
PATH => <empty>
message => c.a.p.c.b.s.Monitor akka://application/user/daemons/monitor : 91 active threads, 4175691776 bytes used
Run Code Online (Sandbox Code Playgroud)
我无法打破消息字符串。我希望匹配的组是:
time => 2015/02/25 18:33:06 +0000
method => INFO
PATH => c.a.p.c.b.s.Monitor
message => akka://application/user/daemons/monitor : 91 active threads, 4175691776 bytes used
Run Code Online (Sandbox Code Playgroud)
什么是合适的正则表达式