新手提醒!Logstash grok定製圖案不會產生任何字段
我有以下神交過濾器:
filter {
grok {
match => [ "message","%{DATESTAMP:timestamp}" ]
match => [ "message", "(?<number_after_timestamp>[0-9]{8}\s\w+)"]
match => [ "message", "(?<error_or_debug>(ERROR|DEBUG))"]
match => [ "message", "(?<first_part>ORB\.thread\.pool.*(?=\s{2}))" ]
match => [ "message", "(?<exception_class_name>(?<=\<Exception class name\=\s).*?\>)" ]
match => [ "message", "(?<exception_message>(?<=\<Exception message\=).*?(?=\>))" ]
}
}
獨立精確匹配的文本塊我需要使用神交調試測試時,每這些模式之一。在Grok調試器中,命名的模式名稱用作字段併發射得很好。但是,當我在grok調試器中使用的相同日誌事件上運行此操作時,不會發出日誌事件行或字段名稱中的任何數據。
例如異常類名模式,得到:
{
"exception_class_name": [
[
"com.ultatica.bd.exceptions.TTFException>"
]
]
}
但是,當對數據從logstash從命令行運行 - >不是香腸!
真的很感激任何幫助。
感謝
日誌文件是這樣的:
[30/09/14 23:07:15:195 BST] 00000043 SystemOut O ERROR9 Tue Sep 30 23:07:15 BST 2014 ORB.thread.pool : 2 webuser com.ultra.bd.services.UltraticoCustomerService.processRequest API getPerson <Exception class name= com.Ultratico.bd.exceptions.UCOException> <Exception message= e05CX432182S> <UCOException Error =9>
[30/09/14 23:07:15:200 BST] 00000043 SystemOut O ERROR9 Tue Sep 30 23:07:15 BST 2014 ORB.thread.pool : 2 webuser com.Ultratico.ecrm.framework.sessionHandler.UltraticoSessionHandler.execute <Exception class name= com.Ultratico.bd.exceptions.UCOException> <Exception message= e05CX432182S> <UCOException Error =9>
你可以添加從輸入(日誌文件等)幾行? – 2014-10-03 13:02:42
編輯OP以顯示樣本日誌行 – user3202399 2014-10-03 13:08:48
可能的重複[使用grok將日誌文件名添加爲logstash中的字段](http://stackoverflow.com/questions/23780000/use-grok-to-add-the-log -filename-as-a-field-in-logstash) – OhadR 2015-06-08 14:46:32