Linux 如何做到快捷查看 linux 环境中的多个实时日志?

kawa · May 05, 2018 · Last by 李雪原 replied at June 17, 2018 · 3855 hits

前提:在测试过程需要关注多个tomcat的多个实时日志
老方式:打开多个ssh回话,分别tail -f不同路径下的不同日志
问题:虽然输命令也不是很慢,但重复的输命令也麻烦啊;不知道为什么xshell一天会断掉大概两次连接,就得再输命令打开日志
一种解决方式:网上搜了才发现,可以tail -f多个日志,这样就可以同时查看多个日志了;但是仍存在问题,有些操作会刷出来很多日志,看着有点不方便;tail -f后写多个路径也有多,最好这一步也省去
问题:有没有可以便捷实时查看多个日志的方法或者工具

最佳回复

log.io推荐给你

共收到 14 条回复 时间 点赞
kawa #1 · May 05, 2018 作者

额,其实tail -f多个日志也差不多能满足我的需求了,就是想找个再好用的方法。。。

kawa #2 · May 05, 2018 作者

是个点子,然而已有技能不足以支撑我搞起这个网站,回头我细细看看,当前想直接用现成的

kawa #3 · May 05, 2018 作者

刚发现xshell有分屏的功能,虽然仍没有解决我的问题,但这个功能也很好用啊

4Floor has been deleted
kawa 回复

有个软件叫 tailon 你看看

用perl写过一个实时监控文件变化的。
用的是 File::Tail 这个模块。
其他语言应该也有类似的实现。

kawa #8 · May 07, 2018 作者
hellohell 回复

懂你的意思了,alias会便捷点,但是本质上还是tail -f多个日志,还存在日志输出过多不方便查看的问题

log.io推荐给你

10Floor has been deleted
kawa #11 · May 17, 2018 作者
李雪原 回复

安装的时候遇到问题啦,能帮忙看看报错咋解决不
[root@localhost ~]# cnpm install -g log.io --user 'root'
Downloading log.io to /usr/local/lib/node_modules/log.io_tmp
Copying /usr/local/lib/node_modules/log.io_tmp/_log.io@0.3.4@log.io to /usr/local/lib/node_modules/log.io
Installing log.io's dependencies to /usr/local/lib/node_modules/log.io/node_modules
[1/9] underscore@~1.4.3 installed at node_modules/_underscore@1.4.4@underscore
[2/9] backbone@~0.9.10 installed at node_modules/_backbone@0.9.10@backbone
[3/9] coffee-script@~1.4.0 installed at node_modules/_coffee-script@1.4.0@coffee-script
[4/9] jquery-browserify@~1.8.1 installed at node_modules/_jquery-browserify@1.8.1@jquery-browserify
[5/9] winston@~0.6.2 installed at node_modules/_winston@0.6.2@winston
[6/9] express@~3.0.1 installed at node_modules/_express@3.0.6@express
[7/9] socket.io-client@~0.9.11 installed at node_modules/_socket.io-client@0.9.17@socket.io-client
[8/9] socket.io@~0.9.13 installed at node_modules/_socket.io@0.9.19@socket.io
jquery@1.8.3 › contextify@~0.1.3 found binding.gyp file, auto run "node-gyp rebuild"
make: Entering directory /usr/local/lib/node_modules/log.io/node_modules/_contextify@0.1.15@contextify/build'
CXX(target) Release/obj.target/contextify/src/contextify.o
../src/contextify.cc: In static member function ‘static v8::Local<v8::Context> ContextWrap::createV8Context(v8::Local<v8::Object>)’:
../src/contextify.cc:131:68: warning: ‘v8::Local<v8::Object> v8::Function::NewInstance() const’ is deprecated (declared at /root/.node-gyp/8.11.2/include/node/v8.h:3851): Use maybe version [-Wdeprecated-declarations]
Local<Object> wrapper = Nan::New(constructor)->NewInstance();
^
../src/contextify.cc:150:16: error: ‘class v8::ObjectTemplate’ has no member named ‘SetAccessCheckCallbacks’
otmpl->SetAccessCheckCallbacks(GlobalPropertyNamedAccessCheck,
^
../src/contextify.cc: In static member function ‘static void ContextWrap::GlobalPropertyGetter(v8::Local<v8::String>, const Nan::PropertyCallbackInfo<v8::Value>&)’:
../src/contextify.cc:182:80: warning: ‘v8::Local<v8::Value> v8::Object::GetRealNamedProperty(v8::Local<v8::String>)’ is deprecated (declared at /root/.node-gyp/8.11.2/include/node/v8.h:3403): Use maybe version [-Wdeprecated-declarations]
Local<Value> rv = Nan::New(ctx->sandbox)->GetRealNamedProperty(property);
^
../src/contextify.cc: In static member function ‘static void ContextWrap::GlobalPropertyQuery(v8::Local<v8::String>, const Nan::PropertyCallbackInfo<v8::Integer>&)’:
../src/contextify.cc:209:67: warning: ‘v8::Local<v8::Value> v8::Object::GetRealNamedProperty(v8::Local<v8::String>)’ is deprecated (declared at /root/.node-gyp/8.11.2/include/node/v8.h:3403): Use maybe version [-Wdeprecated-declarations]
if (!Nan::New(ctx->sandbox)->GetRealNamedProperty(property).IsEmpty() ||
^
../src/contextify.cc:210:71: warning: ‘v8::Local<v8::Value> v8::Object::GetRealNamedProperty(v8::Local<v8::String>)’ is deprecated (declared at /root/.node-gyp/8.11.2/include/node/v8.h:3403): Use maybe version [-Wdeprecated-declarations]
!Nan::New(ctx->proxyGlobal)->GetRealNamedProperty(property).IsEmpty()) {
^
make: *** [Release/obj.target/contextify/src/contextify.o] Error 1
make: Leaving directory
/usr/local/lib/node_modules/log.io/node_modules/_contextify@0.1.15@contextify/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/cnpm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 3.10.0-123.el7.x86_64
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/cnpm/node_modules/npminstall/node-gyp-bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/log.io/node_modules/_contextify@0.1.15@contextify
gyp ERR! node -v v8.11.2
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Install fail! Error: Run "sh -c node-gyp rebuild" error, exit code 1
Error: Run "sh -c node-gyp rebuild" error, exit code 1
at ChildProcess.proc.on.code (/usr/local/lib/node_modules/cnpm/node_modules/runscript/index.js:74:21)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
npminstall version: 3.5.0
npminstall args: /usr/local/bin/node /usr/local/lib/node_modules/cnpm/node_modules/npminstall/bin/install.js --fix-bug-versions --china --userconfig=/root/.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://registry.npm.taobao.org -g log.io --user root

kawa #12 · May 17, 2018 作者
李雪原 回复

https://blog.csdn.net/shootyou/article/details/48347847,参照这个进行安装的,前几步遇到好几个坑,到这一步实在走不动了。。。求帮助

kawa 回复

同样遇到这个问题,google有说切换用户的,有说降低node版本的。难道node的版本这么弱鸡,不向下兼容?之前安装stf也是一堆编译错误,降了node版本才搞定的。node的包管理机制真是蛋疼。

kawa #14 · May 21, 2018 作者
匿名用户 回复

。。。我折腾了好久,试了了好多个版本,用v4.9.1这个版本才行。。。

kawa #15 · May 21, 2018 作者
李雪原 回复

很好用,谢谢

kawa 回复

最近没上testerhome,没看到你求助。搞起来了就好哈

需要 Sign In 后方可回复, 如果你还没有账号请点击这里 Sign Up