[批处理]使用Log.io监控日志变化

背景

多台服务器安装了不同的开发服务,增加日志监控以随时处理情况

方案

log.io

环境

NodeJs

安装

1、log.io直接无法安装上,使用log.io-ts安装上

npm install -g log.io-ts


::切换到taobao镜像,否则执行特别慢
2、从https://github.com/NarrativeScience/Log.io下载Log.io-master.zip,解压到路径 AppDataRoaming pm ode_modules下,并更名为log.io

npm config set registry https://registry.npm.taobao.org
npm install winston -g
::启动服务器
log.io.cmd start-server --pwd xxx --port 8000

3、编写Json文件指定监控文件

[
    {
        "node": "gmjtest1-pc-error",
        "path": "C:/Users/xxx/.pm2/logs/error.log"
    },
    {
        "node": "gmjtest1-pc-out",
        "path": "C:/Users/xxx/.pm2/logs/out.log"
    }
]

4、启动客户端

::启动客户端
log.io.cmd start-client -s http://xxx:8000 -c  log-config.json

5、浏览器访问

http://localhost:8000/?password=xxx

参考资料

https://github.com/xialeistudio/log.io-ts/

https://github.com/NarrativeScience/Log.io

http://www.phperz.com/article/17/0509/274779.html

http://www.qingpingshan.com/jb/javascript/333967.html

原文地址:https://www.cnblogs.com/loveclumsybaby/p/10622974.html