rockyu
(rockyu)
March 26, 2020, 6:51am
1
If my logs is 2020-03-26-12:12:36 aaa
, I want to filter out the date like 2020-03-26-12:12:36
,How can I do it ? My config is
grok {
match => {"message => (?<date>([0-9|-]\S+[0-9|:]\S+)"}
add_field => {
"times" => "%{date}"
}
}
A_B
March 26, 2020, 7:41am
2
Hi @rockyu ,
If you use e.g. Kibana, there is a Grok Debugger where you can test GROK patterns.
Something like this should work
grok {
match => { "message" => "(?<times>%{YEAR}-%{MONTHNUM}-%{MONTHDAY}-%{HOUR}:%{MINUTE}:%{SECOND}) %{DATA:string}$" }
}
That gave me this result
{
"times": "2020-03-26-12:12:36",
"string": "aaa"
}
rockyu
(rockyu)
March 26, 2020, 9:04am
3
Thanks for helping to solve this problem
system
(system)
Closed
April 23, 2020, 9:04am
4
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.