This is a creation in Article, where the information may have evolved or changed.
Remotetail is a tool that supports simultaneous display of log file content updates for multiple remote servers, allowing you to simultaneously monitor changes to one (some) log files in multiple servers, tail -f xxx.log combining the output of commands from multiple servers.
Usage Scenarios
Assuming that the company has two Web servers A and B, due to the initial lack of professional operations to configure centralized logging service system, two servers deployed two sets of identical code to provide Web services, using Nginx as a load balancer, request to be forwarded according to the policy set on the two Web servers.
The items in the AB two server are written to the file system file /home/data/logs/laravel.log . In this case, if we need to see if the Web log is normal, it is generally necessary to log on to two servers, and then separately to tail -f /home/data/logs/laravel.log view the latest log files, which is very inconvenient to troubleshoot the problem. Remotetail to solve this problem, developers can use it to display the log information of two (multiple) servers synchronously.
Installation
Download bin/ the corresponding executable file under the project remote-tail-平台 and add the file to the PATH directory specified in the environment variable of the system.
For example, a directory can be placed under CentOS /usr/local/bin .
mv remote-tail-linux /usr/local/bin/remote-tail
How to use
Requires the host to establish the SSH public key between the remote host and password-free login before use.
remote-tail -hosts 'watcher@192.168.1.226,watcher@192.168.1.225' \-file '/usr/local/openresty/nginx/logs/access.log'
Specify the configuration file
-confYou can specify the read profile for the command by using parameters, and the configuration file is in TOML format, please refer to the example.toml file.
Configuration file example.toml :
# 全局配置,所有的servers中tail_file配置的默认值tail_file="/data/logs/laravel.log"# 服务器配置,可以配置多个# 如果不提供password,则使用当前用户的ssh公钥,建议采用该方式,使用密码方式不安全# server_name, hostname, user 配置为必选,其它可选[servers][servers.1]server_name="测试服务器1"hostname="test1.server.aicode.cc"user="root"tail_file="/var/log/messages"[servers.2]server_name="测试服务器2"hostname="test2.server.aicode.cc"user="root"tail_file="/var/log/messages"[servers.3]server_name="测试服务器3"hostname="test2.server.aicode.cc"user="demo"password="123456"
Execute command:
remote-tail -conf=example.toml
If you are interested in this project, please pay attention to https://github.com/mylxsw/remote-tail.