Input:
2018-11-28 10:22:29
Expected json output:
{
"DateandTime": "2018-11-28 10:22:29",
"Date": "2018-11-28",
"Time": "10:22:29"
}
Grok-pattern: ??
Input:
2018-11-28 10:22:29
Expected json output:
{
"DateandTime": "2018-11-28 10:22:29",
"Date": "2018-11-28",
"Time": "10:22:29"
}
Grok-pattern: ??
This seems to be an easy one and can be easily solved by means of basic grok-patterns. You can consult a reference to those grok-patterns here.
In this case I think that this pattern should solve your problem:
(?<DateandTime>(?<Date>%{YEAR}-%{MONTHNUM}-%{MONTHDAY}) (?<Time>%{TIME}))
Maybe there is a more compact way of doing it using other grok-patterns but it should do the trick anyway.