1

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: ??

Karthik
  • 13
  • 4

1 Answers1

0

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.

Drubio
  • 1,157
  • 3
  • 13
  • 30