Reputation: 1757
I am attempting to parse a portion a date from a string and the numbers are clumped together like this:
file-20170707.log
I would like to turn this into file-[yyyy.MM.dd] -- standard elastic format.
I have tried a few things so far and played with the grok constructors so far.
%{[0-9]{4}:year}%{[0-9]{2}:month}%{[0-9]{2}:day} -- variations on this pattern with no luck.
Thanks.
Upvotes: 0
Views: 32
Reputation: 953
This Grok should set values for YEAR
, MONTH
and DAY
for you from the line you've shown as an example:
file-(?<YEAR>[0-9]{4})(?<MONTH>[0-9]{2})(?<DAY>[0-9]{2})\.log
Upvotes: 1