Log file 1 format
2019-02-26 03:00:50.000 -05:00 172.11.0.1 LOCAL:DEBUG some message
Log file 2 format
2019-01-12T05:03:04.956-05:00 172.11.0.1 LOCAL:DEBUG some message
I have created a common GROK format for the above files and trying to extract the log timestamp in field called logTimestamp. If I run the files separately one by one it works but if I run them both at the same time using filebeat then it fails. My logstash filter is as below
grok {
match => { "message" => ["^%{DATA:date} %{DATA:time} %{DATA:offset} %{GREEDYDATA:msgFragments}$"
]
}
}
mutate {
add_field => { "doc_type" => "utilization"
"trans_type" => "xx"
"record_type" => "yy"
"parse_tag" => "commonSTRING"
}
}
if [date] =~ /([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))(?!T)/ {
mutate {
add_field => { "logTimestamp" => "%{date}T%{time}%{offset}"}
}
}
else {
mutate {
add_field => { "logTimestamp" => "%{date}"}
}
}
date {
match => [ "logTimestamp", "ISO8601" ]
}
@magnusbaeck -- can you please help me understand what I may be doing wrong ? thanks in advance !