[Why] Time requires a specific format to be resolved by ES to date type
[Reference] https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date...
Signed-off-by: Wu Zhende wuzhende666@163.com --- src/lib/json_logger.cr | 1 + 1 file changed, 1 insertion(+)
diff --git a/src/lib/json_logger.cr b/src/lib/json_logger.cr index d136bdd..9596243 100644 --- a/src/lib/json_logger.cr +++ b/src/lib/json_logger.cr @@ -15,6 +15,7 @@ class JSONLogger < Logger Logger::Formatter.new do | severity, datetime, progname, msg, io| get_env_info(@env.as(HTTP::Server::Context)) if @env level_num = severity.to_i32 + datetime = datetime.to_s("%Y-%m-%dT%H:%M:%S") logger_hash = JSON.parse(%({"level_num": #{level_num}, "level": "#{severity}", "time": "#{datetime}"