filter_parser: fix timestamp handling on failure scenario
@@ -262,11 +262,17 @@ static int cb_parser_filter(void *data, size_t bytes,
(void **) &out_buf, &out_size,
&parsed_time);
if (parse_ret >= 0) {
- if (flb_time_to_double(&parsed_time) == 0) {
- flb_time_get(&parsed_time);
- }
-
+ /*
+ * If the parser succeeded we need to check the
+ * status of the parsed time. If the time was
+ * parsed successfully 'parsed_time' will be
+ * different than zero, if so, override the time
+ * holder with the new value, otherwise keep the
+ * original.
+ */
+ if (flb_time_to_double(&parsed_time) != 0.0) {
flb_time_copy(&tm, &parsed_time);
+ }
if (ctx->reserve_data) {
if (!ctx->preserve_key) {
