1

log.io部署

  1. 安装node(略)
2.安装log.io
[root@dev-bizapp-211l ~]# npm config set registry https://registry.npm.taobao.org  
[root@dev-bizapp-211l ~]# npm install -g log.io  
/data/xxxx-node/bin/log.io-server -> /data/xxxx-node/lib/node_modules/log.io/bin/log.io-server  
npm WARN ws@7.2.3 requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.  
npm WARN ws@7.2.3 requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.

+ log.io@0.4.13

[root@dev-bizapp-211l log.io-file-input]# cat /etc/profile.d/node.sh 

#set node environment  
NODE_HOME=/data/xxxx-node/bin  
PATH=/data/xxxx-node/bin:/data/xxxx-node/lib/node_modules/pm2/bin:/data/xxxx-java/bin:/data/xxxx-java/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin  
export NODE_HOME PATH

// 添加 node的log.io的模块环境变量  /data/xxxx-node/lib/node_modules/log.io/bin
3.log.io 客户端安装
[root@dev-bizapp-211l log.io-file-input]# npm install -g log.io-file-input  
/data/xxxx-node/bin/log.io-file-input -> /data/xxxx-node/lib/node_modules/log.io-file-input/bin/log.io-file-input  
+ log.io-file-input@0.4.13  
added 3 packages from 2 contributors in 0.724s

配置log.io server端的 config.json

[root@dev-bizapp-211l log.io-file-input]# cd /data/xxxx-node/lib/node_modules/log.io/  
[root@dev-bizapp-211l log.io]# ls  
babel.config.js  bin  config.json  harvester.conf  lib  LICENSE  node_modules  package.json  README.md  tsconfig.json  
[root@dev-bizapp-211l log.io]# pwd  
/data/xxxx-node/lib/node_modules/log.io  
[root@dev-bizapp-211l log.io]# cat config.json   
{  
  "debug": true,  
  "messageServer": {  
    "port": 6689,  
    "host": "0.0.0.0"  
  },  
  "httpServer": {  
    "port": 6688,  
    "host": "0.0.0.0"  
  }  
}
  • 127.0.0.1 最好改成0.0.0.0

配置log.io-file-input 客户端的 config.json

[root@dev-bizapp-211l log.io-file-input]# ls  
babel.config.js  bin  config.json  lib  LICENSE  node_modules  package.json  README.md  tsconfig.json  
[root@dev-bizapp-211l log.io-file-input]# pwd  
/data/xxxx-node/lib/node_modules/log.io-file-input  
[root@dev-bizapp-211l log.io-file-input]# cat config.json   
{  
  "messageServer": {  
    "host": "192.168.120.25",  
    "port": 6689  
  },  
  "inputs": [  
    {  
      "source": "biz_admin_management_system_app_dev.log",  
      "stream": "biz_admin_management_system_app_dev.log",  
      "config": {  
        "path": "/data/logs/biz_admin_management_system_app_dev.log"  
      }  
    },  
    {  
      "source": "biz_cas_dev.log",  
      "stream": "biz_cas_dev.log",  
      "config": {  
        "path": "/data/logs/biz_cas_dev.log"  
      }  
    },  
    {  
      "source": "biz_member_process_center_logic_dev.log",  
      "stream": "biz_member_process_center_logic_dev.log",  
      "config": {  
        "path": "/data/logs/biz_member_process_center_logic_dev.log"  
      }  
    },  
    {  
      "source": "biz_schedule_management_center_logic_dev.log",  
      "stream": "biz_schedule_management_center_logic_dev.log",  
      "config": {  
        "path": "/data/logs/biz_schedule_management_center_logic_dev.log"  
      }  
    }  
  ]  
}

运行测试

server 端
[root@localhost log.io]# nohup log.io-server start > logio.log &  
[1] 60116  
[root@localhost log.io]# nohup: 忽略输入重定向错误到标准输出端

[root@localhost log.io]# ls  
babel.config.js  bin  config.json  lib  LICENSE  logio.log  node_modules  package.json  README.md  tsconfig.json  
[root@localhost log.io]# cat config.json   
{  
  "debug": true,  
  "messageServer": {  
    "port": 6689,  
    "host": "0.0.0.0"  
  },  
  "httpServer": {  
    "port": 6688,  
    "host": "0.0.0.0"  
  }  
}  
[root@localhost log.io]# netstat -tnlp  
Active Internet connections (only servers)  
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name      
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      2368/mysqld           
tcp        0      0 0.0.0.0:1194            0.0.0.0:*               LISTEN      1060/openvpn          
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd             
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1059/sshd             
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      2424/master           
tcp        0      0 0.0.0.0:6688            0.0.0.0:*               LISTEN      60116/node            
tcp        0      0 0.0.0.0:6689            0.0.0.0:*               LISTEN      60116/node            
tcp6       0      0 :::111                  :::*                    LISTEN      1/systemd             
tcp6       0      0 :::22                   :::*                    LISTEN      1059/sshd             
tcp6       0      0 ::1:25                  :::*                    LISTEN      2424/master           
[root@localhost log.io]#
client 端
  • log.io-file-input (nohup log.io-file-input & ###后台运行)

image.png


锅包肉
89 声望17 粉丝

这个人很懒,没有什么说的。