Kermal log format is as follows:
172.17.0.1 - - [13/Apr/2021:07:53:18 +0800] "GET/~lkp/cgi-bin/lkp-post-run?job_id=crystal.673&source=lifecycle&job_ste=timeout HTTP/1.1" 200 4 "-" "Crystal"
change to json:
{"level_num":1,"level":"INFO","time":"2021-04-13T16:29:15.064+0800","from":"172.168.131.113:60512","message":"access_record","status_code":200,"method":"PUT","resource":"el_host2queues?host=dc-8g.wuzhende-361524","elapsed":"496.32µs"}
Signed-off-by: Wu Zhende <wuzhende666(a)163.com>
---
src/lib/sched.cr | 1 -
src/scheduler/scheduler.cr | 2 ++
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/lib/sched.cr b/src/lib/sched.cr
index f62f83e..58ab8e6 100644
--- a/src/lib/sched.cr
+++ b/src/lib/sched.cr
@@ -54,7 +54,6 @@ class Sched
end
def alive(version)
- debug_message("Env= {\n#{`export`}}")
"LKP Alive! The time is #{Time.local}, version = #{version}"
rescue e
@log.warn(e)
diff --git a/src/scheduler/scheduler.cr b/src/scheduler/scheduler.cr
index ee13fd3..ae30937 100644
--- a/src/scheduler/scheduler.cr
+++ b/src/scheduler/scheduler.cr
@@ -31,6 +31,7 @@ require "../lib/json_logger"
#
module Scheduler
VERSION = "0.2.0"
+ logging false
add_context_storage_type(Time::Span)
@@ -43,6 +44,7 @@ module Scheduler
after_all do |env|
env.sched.etcd_close
+ env.log.info(%({"from": "#{env.request.remote_address}", "message": "access_record"}))
end
# echo alive
--
2.23.0