我正在尝试为这样的东西创建一个 grok 模式
********************************************************
18.03.13, 10:14:25: Starting new session
********************************************************
12:43:38 Warning: X-Ray blocked because signal XRAY_ENABLE_FPD is high.
13:31:08 Error 770.999 (DigitizerPt1000Pixium):
OffsetCalibration: mode not active
13:31:21 Error 770.999 (DigitizerPt1000Pixium):
Cannot stop grabbing
然而
13:31:08 Error 770.999 (DigitizerPt1000Pixium):
OffsetCalibration: mode not active
这是一个日志条目而不是两个(grok 将其视为两个不同的条目) grok 或任何其他过滤器中是否有任何模式我可以使用???
我还想将第一行中给出的日期与警告和错误日志条目相关联
注意:我为它创建了 grok 模式,只有以下问题未解决。
我尝试使用以下代码(对于此处给出的整个日志文件)。但我无法将第一行的日期与错误和警告条目联系起来
input {
file {
path => "E:\Softwares\logstash-1.5.4\bin\Error_log_29092015.txt"
start_position => beginning
sincedb_path => "E:/sincedb"
}
}
filter {
multiline {
pattern => "^%{NOTSPACE}"
what => previous
}
if "Starting" in [message]{
grok {
match => [ "message", "%{DATE_EU:Start_date}, %{TIME:Start_time}: %{WORD:session_status}"]
}
}
else if "Terminating" in [message] {
grok{
match => [ "message", "%{DATE_EU:Terminate_date}, %{TIME:Terminate_time}: %{WORD:session_status}"]
}
}
else if "Warning" in [message] {
grok {
match => [ "message", "%{TIME:Warning_time} \t%{WORD:Indicator}: %{GREEDYDATA:Warning_Message}\r"]
}
}
else if "Error" in [message] {
if "Generator" in [message]{
grok{
match => ["message","%{TIME:Error_time} \t%{WORD:Indicator} G %{NOTSPACE:Error_Num} %{NOTSPACE:Error_Type}: \r\n%{GREEDYDATA:Error_Message}\r"]
}
}
else{
grok {
match => [ "message", "%{TIME:Error_time} \t%{WORD:Indicator} %{NOTSPACE:Error_Num} %{NOTSPACE:Error_Type}: \r\n%{GREEDYDATA:Error_Message}\r"]
}
}
}
else if "Invalid" in [message]{
grok {
match => [ "message", "%{TIME:InvalidCode_time} \t%{WORD:Type} Code. %{GREEDYDATA:InvalidCode_Message}"]
}
}
else if "Sedecal" in [message]{
grok {
match => [ "message", "%{TIME:Sedecal_time} \t%{GREEDYDATA:Type}: %{GREEDYDATA:InvalidCode_Message}"]
}
}
else if "UIMS" in [message]{
grok {
match => [ "message", "%{TIME:UIMSInternalState_time} \t%{GREEDYDATA:Type}: %{GREEDYDATA:UIMSInternalState_Message}"]
}
}
else {
drop{}
}
}
output {
stdout{ codec => rubydebug}
elasticsearch{
cluster => "My_ProjectC"
host => localhost
codec => rubydebug}
}