FluentD date and time format does not match
This is my FluentD parser configuration:
<filter format.3.**>
@type parser
format /^\[(?<module>[^\]]+)\] (?<time>.+): (?<msg>.*)$/
time_format %Y-%m-%d %H:%M:%S
key_name log
keep_time_key true
reserve_data false
</filter>
And that's an example of a log line:
[Macaron] 2017-04-26 16:54:26: Started GET / for 172.20.0.0
In the FluentD error log, I get:
2017-04-27 12:01:58 +0000 [warn]: plugin/filter_parser.rb:69:rescue in block in filter_stream: invalid time format: value = 2017-04-27 12:01:58, error_class = ArgumentError, error = invalid strptime format - `%Y-%m-%d %H:%M:%S'
An important part:
invalid time format: value = 2017-04-27 12:01:58, error_class = ArgumentError, error = invalid strptime format - `%Y-%m-%d %H:%M:%S'
But I don't see how it %Y-%m-%d %H:%M:%S
doesn't match 2017-04-27 12:01:58
, or why this format is invalid.
+3
source to share
1 answer
I realized there were some special characters to set the colors in the magazine. Apparently when copying them to fluentular.herokuapp.com they were not copied and why it worked there:
{"log":"[Macaron] \u001b[1;32m2017-04-27 12:34:07: Completed /node 200 OK in 1.163351ms\u001b[0m\n","stream":"stdout","time":"2017-04-27T12:34:07.953993591Z"}
0
source to share