Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Logging 将远程文件拖尾到本地文件_Logging_Ssh_Aggregation_Tail - Fatal编程技术网

Logging 将远程文件拖尾到本地文件

Logging 将远程文件拖尾到本地文件,logging,ssh,aggregation,tail,Logging,Ssh,Aggregation,Tail,我有一些远程日志,我想将它们拖尾到本地日志中,以保持日志附加的时间顺序。 我有5个上游服务器,每个服务器运行一个web应用程序,该应用程序在本地登录到app.log文件,代理服务器向5个服务器发送负载平衡请求。我想将这些app.log文件聚合到代理服务器中的单个app.log文件中。我将如何实现这一点?我在考虑为每台服务器保持一个SSH连接的全天候活动,并将SSH终端输出附加到app.log文件中。有更好的方法吗?有 这正是你需要的。只需创建如下配置: aliases: - &

我有一些远程日志,我想将它们
拖尾到本地日志中,以保持日志附加的时间顺序。
我有5个上游服务器,每个服务器运行一个web应用程序,该应用程序在本地登录到
app.log
文件,代理服务器向5个服务器发送负载平衡请求。我想将这些app.log文件聚合到代理服务器中的单个
app.log
文件中。我将如何实现这一点?我在考虑为每台服务器保持一个SSH连接的全天候活动,并将SSH终端输出附加到
app.log
文件中。有更好的方法吗?

这正是你需要的。只需创建如下配置:

aliases:  
    - &my_commands
        pingYa:
            exec: ping ya.ru
            extension: log
        pingGoo:
            exec: ping goo.gl
            extension: log

    - &ssh_auth
        user: {{env_USER}}
        passphrase: {{env_PASSWORD}}

sources:
    localhost:
        type: local
        commands: *my_commands
    remotehost:
        host: 192.168.1.9
        type: ssh2
        parameters: *ssh_auth
        commands: *my_commands
    remotehost2:
        host: 192.168.1.9
        type: ssh2
        parameters: *ssh_auth
        commands: *my_commands
    remotehost3:
        host: 192.168.1.9
        type: ssh2
        parameters: *ssh_auth
        commands: *my_commands

这正是你需要的。只需创建如下配置:

aliases:  
    - &my_commands
        pingYa:
            exec: ping ya.ru
            extension: log
        pingGoo:
            exec: ping goo.gl
            extension: log

    - &ssh_auth
        user: {{env_USER}}
        passphrase: {{env_PASSWORD}}

sources:
    localhost:
        type: local
        commands: *my_commands
    remotehost:
        host: 192.168.1.9
        type: ssh2
        parameters: *ssh_auth
        commands: *my_commands
    remotehost2:
        host: 192.168.1.9
        type: ssh2
        parameters: *ssh_auth
        commands: *my_commands
    remotehost3:
        host: 192.168.1.9
        type: ssh2
        parameters: *ssh_auth
        commands: *my_commands