ccfos / nightingale

An all-in-one observability solution which aims to combine the advantages of Prometheus and Grafana. It manages alert rules and visualizes metrics, logs, traces in a beautiful web UI.
https://flashcat.cloud/docs/
Apache License 2.0
9.42k stars 1.38k forks source link

查看运行任务中的日志的功能 #1989

Closed rayn316 closed 1 month ago

rayn316 commented 2 months ago

What would you like to be added: 可以对运行稍微时间长的脚本判断当前运行情况

Why is this needed: 运行的任务有时候会比较久或者卡住,但是任务没有完成是看不到日志,不方便排查情况,后续是否会变成执行中也能查看日志?

kongfei605 commented 2 months ago

有stdout 和 stderr ,要不脚本中多输出一些内容试试?

rayn316 commented 2 months ago

未执行完成,是没有产生输出文件的 @kongfei605 只有在运行完成才有stdout 和 stderr image 1

UlricQin commented 2 months ago

最佳的做法是客户端和服务端直接建立 websocket 长连接,想看 categraf 内存里的任务的 stdout 和 stderr 的时候,直接通过 WebSocket 查看,不过这个工程就大了,得从长计议

rayn316 commented 2 months ago

夜莺任务页面查看输出时,是从执行服务器categraf重新获取的,还是夜莺先缓存任务保存结果,直接从夜莺返回的?

UlricQin commented 2 months ago

categraf 执行完了之后上报给夜莺,夜莺存到DB,用户查看的时候直接从DB获取的。这里也可以优化一下,让 categraf 每 5s 上报一次,即便没有执行完也上报,当然,带来的问题就是DB压力会比较大

rayn316 commented 1 month ago

我们这边写了相关功能,要是运行一阵后没有问题会合并代码

rayn316 commented 1 month ago

这个功能,我朋友应该合并代码完成,这个问题先关闭了