From 7b4df270b6531c8977090acdcdd8d8dbdb293ed2 Mon Sep 17 00:00:00 2001 From: Marc Guasch Date: Wed, 14 Oct 2020 09:33:41 +0200 Subject: [PATCH] Only check for parse errors --- x-pack/filebeat/input/httpjson/config.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/x-pack/filebeat/input/httpjson/config.go b/x-pack/filebeat/input/httpjson/config.go index 2b011311474..6384811aaa4 100644 --- a/x-pack/filebeat/input/httpjson/config.go +++ b/x-pack/filebeat/input/httpjson/config.go @@ -127,11 +127,10 @@ func (dc *dateCursorConfig) Validate() error { } const knownTimestamp = 1602601228 // 2020-10-13T15:00:28+00:00 RFC3339 + knownDate := time.Unix(knownTimestamp, 0).UTC() - // if we can't get back the same date from Format than from Parse - // it is because the defined format is invalid - dateStr := time.Unix(knownTimestamp, 0).UTC().Format(dc.DateFormat) - if t, err := time.Parse(dc.DateFormat, dateStr); err != nil || t.Unix() != knownTimestamp { + dateStr := knownDate.Format(dc.DateFormat) + if _, err := time.Parse(dc.DateFormat, dateStr); err != nil { return errors.New("invalid configuration: date_format is not a valid date layout") }